From: Fan Zhang Date: Thu, 3 Nov 2016 12:12:40 +0000 (+0000) Subject: examples/ipsec-secgw: fix configuration string termination X-Git-Tag: spdx-start~5394 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=07b156199f;p=dpdk.git examples/ipsec-secgw: fix configuration string termination Coverity issue: 137854, 137855 Fixes: 0d547ed03717 ("examples/ipsec-secgw: support configuration file") Signed-off-by: Fan Zhang Acked-by: Ferruh Yigit --- diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c index 99bdfc5af2..598f435732 100644 --- a/examples/ipsec-secgw/parser.c +++ b/examples/ipsec-secgw/parser.c @@ -248,7 +248,7 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) if (mask) *mask = atoi(pch); } else { - strncpy(ip_str, token, sizeof(ip_str)); + strncpy(ip_str, token, sizeof(ip_str) - 1); if (mask) *mask = 0; } @@ -277,7 +277,7 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) if (mask) *mask = atoi(pch); } else { - strncpy(ip_str, token, sizeof(ip_str)); + strncpy(ip_str, token, sizeof(ip_str) - 1); if (mask) *mask = 0; }