[dpdk-dev] [PATCH] examples/ipsec-secgw: fix copy into fixed size buffer issue

Fan Zhang roy.fan.zhang at intel.com
Thu Nov 3 13:12:42 CET 2016


Coverity issue: 137875
Fixes: 0d547ed0 ("examples/ipsec-secgw: support configuration
file")

Signed-off-by: Fan Zhang <roy.fan.zhang at intel.com>
---
 examples/ipsec-secgw/sa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index 9e2c8a9..c891be2 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -177,7 +177,7 @@ parse_key_string(const char *key_str, uint8_t *key)
 		pt_end = strchr(pt_start, ':');
 
 		if (pt_end == NULL)
-			strncpy(sub_str, pt_start, strlen(pt_start));
+			strncpy(sub_str, pt_start, strlen(sub_str) - 1);
 		else {
 			if (pt_end - pt_start > 2)
 				return 0;
-- 
2.5.5



More information about the dev mailing list