examples/ipsec-secgw: fix configuration string termination
Coverity issue: 137854, 137855
Fixes: 0d547ed037
("examples/ipsec-secgw: support configuration file")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
7e70f8a608
commit
07b156199f
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user