From 07b156199fa2d5de7e40b865c90fa4b6d99e09d0 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Thu, 3 Nov 2016 12:12:40 +0000 Subject: [PATCH] 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 --- examples/ipsec-secgw/parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.20.1