All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] examples/ipsec-secgw: replace strncpy with strlcpy
@ 2018-05-09 11:35 Reshma Pattan
  2018-05-09 11:35 ` [PATCH] examples/quota_watermark: fix gcc 8.0.1 cast between incompatible types Reshma Pattan
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Reshma Pattan @ 2018-05-09 11:35 UTC (permalink / raw)
  To: dev; +Cc: stable, Zhang,Roy Fan, Reshma Pattan

Use strlcpy instead of strncpy.

Fixes: 0d547ed037 ("examples/ipsec-secgw: support configuration file")
Fixes: 07b156199f ("examples/ipsec-secgw: fix configuration string termination")
Fixes: a1469c319f ("examples/ipsec-secgw: fix configuration parsing")
Cc: stable@dpdk.org
CC: Zhang,Roy Fan <roy.fan.zhang@intel.com>

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/ipsec-secgw/parser.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c
index 2403b564d..9ccd5ea72 100644
--- a/examples/ipsec-secgw/parser.c
+++ b/examples/ipsec-secgw/parser.c
@@ -3,6 +3,7 @@
  */
 #include <rte_common.h>
 #include <rte_crypto.h>
+#include <rte_string_fns.h>
 
 #include <cmdline_parse_string.h>
 #include <cmdline_parse_num.h>
@@ -212,14 +213,14 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask)
 
 	pch = strchr(token, '/');
 	if (pch != NULL) {
-		strncpy(ip_str, token, pch - token);
+		strlcpy(ip_str, token, pch - token);
 		pch += 1;
 		if (is_str_num(pch) != 0)
 			return -EINVAL;
 		if (mask)
 			*mask = atoi(pch);
 	} else {
-		strncpy(ip_str, token, sizeof(ip_str) - 1);
+		strlcpy(ip_str, token, sizeof(ip_str) - 1);
 		if (mask)
 			*mask = 0;
 	}
@@ -241,14 +242,14 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask)
 
 	pch = strchr(token, '/');
 	if (pch != NULL) {
-		strncpy(ip_str, token, pch - token);
+		strlcpy(ip_str, token, pch - token);
 		pch += 1;
 		if (is_str_num(pch) != 0)
 			return -EINVAL;
 		if (mask)
 			*mask = atoi(pch);
 	} else {
-		strncpy(ip_str, token, sizeof(ip_str) - 1);
+		strlcpy(ip_str, token, sizeof(ip_str) - 1);
 		if (mask)
 			*mask = 0;
 	}
@@ -515,7 +516,7 @@ parse_cfg_file(const char *cfg_filename)
 				goto error_exit;
 			}
 
-			strncpy(str + strlen(str), oneline,
+			strlcpy(str + strlen(str), oneline,
 				strlen(oneline));
 
 			continue;
@@ -528,7 +529,7 @@ parse_cfg_file(const char *cfg_filename)
 				cfg_filename, line_num);
 			goto error_exit;
 		}
-		strncpy(str + strlen(str), oneline,
+		strlcpy(str + strlen(str), oneline,
 			strlen(oneline));
 
 		str[strlen(str)] = '\n';
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-05-13 21:52 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 11:35 [PATCH] examples/ipsec-secgw: replace strncpy with strlcpy Reshma Pattan
2018-05-09 11:35 ` [PATCH] examples/quota_watermark: fix gcc 8.0.1 cast between incompatible types Reshma Pattan
2018-05-11 15:48   ` [dpdk-stable] " De Lara Guarch, Pablo
2018-05-13 21:45   ` Thomas Monjalon
2018-05-09 11:35 ` [PATCH] examples/vhost_scsi: replace strncpy with strlcpy Reshma Pattan
2018-05-09 13:37   ` Bruce Richardson
2018-05-09 16:38     ` Pattan, Reshma
2018-05-10 12:24     ` Pattan, Reshma
2018-05-10 12:05   ` [PATCH v2] " Reshma Pattan
2018-05-10 13:31     ` Bruce Richardson
2018-05-13 21:50       ` Thomas Monjalon
2018-05-09 13:35 ` [PATCH] examples/ipsec-secgw: " Bruce Richardson
2018-05-09 15:56 ` [PATCH v2] " Reshma Pattan
2018-05-09 16:11   ` [PATCH v3] " Reshma Pattan
2018-05-11 16:38     ` [dpdk-stable] " De Lara Guarch, Pablo
2018-05-13 21:52       ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.