DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] cmdline: fix ressize in parse_portlist
@ 2015-02-04  9:49 Olivier Matz
  2015-02-20  9:52 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Olivier Matz @ 2015-02-04  9:49 UTC (permalink / raw)
  To: dev

The argument ressize contains the size of the result buffer which
should be large enough to store the parsed result of a token. In
this case, it should be larger or equal to sizeof(cmdline_portlist_t)
(4 bytes), not PORTLIST_TOKEN_SIZE which is the max size of the token
string.

This is not a critical, it fixes cases where the total length of the
parsed instruction is greater than the maximum.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/librte_cmdline/cmdline_parse_portlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_cmdline/cmdline_parse_portlist.c b/lib/librte_cmdline/cmdline_parse_portlist.c
index 834f2e6..fc6c14e 100644
--- a/lib/librte_cmdline/cmdline_parse_portlist.c
+++ b/lib/librte_cmdline/cmdline_parse_portlist.c
@@ -136,7 +136,7 @@ cmdline_parse_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk,
 	if (!buf || ! *buf)
 		return (-1);
 
-	if (res && ressize < PORTLIST_TOKEN_SIZE)
+	if (res && ressize < sizeof(cmdline_portlist_t))
 		return -1;
 
 	pl = res;
-- 
2.1.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] cmdline: fix ressize in parse_portlist
  2015-02-04  9:49 [dpdk-dev] [PATCH] cmdline: fix ressize in parse_portlist Olivier Matz
@ 2015-02-20  9:52 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-02-20  9:52 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev

2015-02-04 10:49, Olivier Matz:
> The argument ressize contains the size of the result buffer which
> should be large enough to store the parsed result of a token. In
> this case, it should be larger or equal to sizeof(cmdline_portlist_t)
> (4 bytes), not PORTLIST_TOKEN_SIZE which is the max size of the token
> string.
> 
> This is not a critical, it fixes cases where the total length of the
> parsed instruction is greater than the maximum.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-20  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04  9:49 [dpdk-dev] [PATCH] cmdline: fix ressize in parse_portlist Olivier Matz
2015-02-20  9:52 ` 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).