path: root/lib/librte_cmdline
diff options
authorOlivier Matz <>2015-02-04 10:49:25 +0100
committerThomas Monjalon <>2015-02-20 10:50:16 +0100
commitac09cd97322fd3524082333aaab10885503eec83 (patch)
tree6091d6e067964e61808863ad3b8e946dd4f3474c /lib/librte_cmdline
parentd3aa5274ca46faacf08934d285bb4b4f2cd6d115 (diff)
cmdline: fix check in port list parsing
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 <>
Diffstat (limited to 'lib/librte_cmdline')
1 files changed, 1 insertions, 1 deletions
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;