* [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip address parsing
@ 2018-05-14 10:00 Kirill Rybalchenko
2018-05-14 11:25 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 3+ messages in thread
From: Kirill Rybalchenko @ 2018-05-14 10:00 UTC (permalink / raw)
To: dev
Cc: stable, kirill.rybalchenko, radu.nicolau, akhil.goyal,
roy.fan.zhang, reshma.pattan, pablo.de.lara.guarch
In strlcpy function parameters there was no allowance for
null terminator, so ip address was copied without last character.
Fixes: ae943ebe1ed3 ("examples/ipsec-secgw: replace strncpy with strlcpy")
Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
examples/ipsec-secgw/parser.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c
index e2e3429..91282ca 100644
--- a/examples/ipsec-secgw/parser.c
+++ b/examples/ipsec-secgw/parser.c
@@ -213,8 +213,9 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask)
pch = strchr(token, '/');
if (pch != NULL) {
- strlcpy(ip_str, token, RTE_MIN((unsigned int long)(pch - token),
- sizeof(ip_str)));
+ strlcpy(ip_str, token,
+ RTE_MIN((unsigned int long)(pch - token + 1),
+ sizeof(ip_str)));
pch += 1;
if (is_str_num(pch) != 0)
return -EINVAL;
@@ -225,7 +226,6 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask)
if (mask)
*mask = 0;
}
-
if (strlen(ip_str) >= INET_ADDRSTRLEN)
return -EINVAL;
@@ -243,7 +243,8 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask)
pch = strchr(token, '/');
if (pch != NULL) {
- strlcpy(ip_str, token, RTE_MIN((unsigned int long)(pch - token),
+ strlcpy(ip_str, token,
+ RTE_MIN((unsigned int long)(pch - token + 1),
sizeof(ip_str)));
pch += 1;
if (is_str_num(pch) != 0)
--
2.5.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip address parsing
2018-05-14 10:00 [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip address parsing Kirill Rybalchenko
@ 2018-05-14 11:25 ` De Lara Guarch, Pablo
2018-05-14 12:09 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2018-05-14 11:25 UTC (permalink / raw)
To: Rybalchenko, Kirill, dev
Cc: stable, Nicolau, Radu, akhil.goyal, Zhang, Roy Fan, Pattan,
Reshma, thomas
> -----Original Message-----
> From: Rybalchenko, Kirill
> Sent: Monday, May 14, 2018 11:01 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Rybalchenko, Kirill <kirill.rybalchenko@intel.com>;
> Nicolau, Radu <radu.nicolau@intel.com>; akhil.goyal@nxp.com; Zhang, Roy Fan
> <roy.fan.zhang@intel.com>; Pattan, Reshma <reshma.pattan@intel.com>; De
> Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH] examples/ipsec-secgw: fix ip address parsing
>
> In strlcpy function parameters there was no allowance for null terminator, so ip
> address was copied without last character.
>
> Fixes: ae943ebe1ed3 ("examples/ipsec-secgw: replace strncpy with strlcpy")
>
> Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This is fixing a fix that is going into stable, so it needs to go too.
Thomas, could you add "Cc: stable@dpdk.org" when applying this?
Thanks,
Pablo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ipsec-secgw: fix ip address parsing
2018-05-14 11:25 ` De Lara Guarch, Pablo
@ 2018-05-14 12:09 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-05-14 12:09 UTC (permalink / raw)
To: Rybalchenko, Kirill
Cc: dev, De Lara Guarch, Pablo, stable, Nicolau, Radu, akhil.goyal,
Zhang, Roy Fan, Pattan, Reshma
> > In strlcpy function parameters there was no allowance for null terminator, so ip
> > address was copied without last character.
> >
> > Fixes: ae943ebe1ed3 ("examples/ipsec-secgw: replace strncpy with strlcpy")
> >
> > Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>
> This is fixing a fix that is going into stable, so it needs to go too.
> Thomas, could you add "Cc: stable@dpdk.org" when applying this?
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-14 12:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 10:00 [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip address parsing Kirill Rybalchenko
2018-05-14 11:25 ` De Lara Guarch, Pablo
2018-05-14 12:09 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).