X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fcmdline%2Fparse_obj_list.c;h=cdbaf2fead9450ee8d07da01705df79576c3038f;hb=c2150ad4c46427e72fe1b21fc35a77cf1bab193d;hp=45a26ef7a6649b369b21672d5de8706a9252eb93;hpb=3031749c2df04a63cdcef186dcce3781e61436e8;p=dpdk.git diff --git a/examples/cmdline/parse_obj_list.c b/examples/cmdline/parse_obj_list.c index 45a26ef7a6..cdbaf2fead 100644 --- a/examples/cmdline/parse_obj_list.c +++ b/examples/cmdline/parse_obj_list.c @@ -84,7 +84,8 @@ struct cmdline_token_ops token_obj_list_ops = { }; int -parse_obj_list(cmdline_parse_token_hdr_t *tk, const char *buf, void *res) +parse_obj_list(cmdline_parse_token_hdr_t *tk, const char *buf, void *res, + unsigned ressize) { struct token_obj_list *tk2 = (struct token_obj_list *)tk; struct token_obj_list_data *tkd = &tk2->obj_list_data; @@ -94,6 +95,9 @@ parse_obj_list(cmdline_parse_token_hdr_t *tk, const char *buf, void *res) if (*buf == 0) return -1; + if (res && ressize < sizeof(struct object *)) + return -1; + while(!cmdline_isendoftoken(buf[token_len])) token_len++; @@ -148,7 +152,7 @@ int complete_get_elt_obj_list(cmdline_parse_token_hdr_t *tk, return -1; if (dstbuf) - rte_snprintf(dstbuf, size, "%s", o->name); + snprintf(dstbuf, size, "%s", o->name); return 0; } @@ -157,6 +161,6 @@ int complete_get_elt_obj_list(cmdline_parse_token_hdr_t *tk, int get_help_obj_list(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, char *dstbuf, unsigned int size) { - rte_snprintf(dstbuf, size, "Obj-List"); + snprintf(dstbuf, size, "Obj-List"); return 0; }