cmdline: fix overflow on bsd
[dpdk.git] / lib / librte_cmdline / cmdline_parse_etheraddr.c
index 5285c40..64ae86c 100644 (file)
@@ -137,12 +137,15 @@ my_ether_aton(const char *a)
 
 int
 cmdline_parse_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk,
-                       const char *buf, void *res)
+       const char *buf, void *res, unsigned ressize)
 {
        unsigned int token_len = 0;
        char ether_str[ETHER_ADDRSTRLENLONG+1];
        struct ether_addr *tmp;
 
+       if (res && ressize < sizeof(struct ether_addr))
+               return -1;
+
        if (!buf || ! *buf)
                return -1;