summaryrefslogtreecommitdiff
path: root/lib/librte_cmdline/cmdline_parse_ipaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_cmdline/cmdline_parse_ipaddr.c')
-rw-r--r--lib/librte_cmdline/cmdline_parse_ipaddr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c
index ac83514..7f33599 100644
--- a/lib/librte_cmdline/cmdline_parse_ipaddr.c
+++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c
@@ -306,7 +306,8 @@ inet_pton6(const char *src, unsigned char *dst)
}
int
-cmdline_parse_ipaddr(cmdline_parse_token_hdr_t *tk, const char *buf, void *res)
+cmdline_parse_ipaddr(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
+ unsigned ressize)
{
struct cmdline_token_ipaddr *tk2;
unsigned int token_len = 0;
@@ -315,6 +316,9 @@ cmdline_parse_ipaddr(cmdline_parse_token_hdr_t *tk, const char *buf, void *res)
char *prefix, *prefix_end;
long prefixlen = 0;
+ if (res && ressize < sizeof(cmdline_ipaddr_t))
+ return -1;
+
if (!buf || !tk || ! *buf)
return -1;