]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_kvargs/rte_kvargs.c
fix
[dpdk.git] / lib / librte_kvargs / rte_kvargs.c
index d39332999e2b4f985070ef8aaf689721efa0f294..1d815dcd96341ff1261869045bbbacfb038c9ea3 100644 (file)
@@ -50,6 +50,8 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params)
                        /* Find the end of the list. */
                        while (str[strlen(str) - 1] != ']') {
                                /* Restore the comma erased by strtok_r(). */
+                               if (ctx1[0] == '\0')
+                                       return -1; /* no closing bracket */
                                str[strlen(str)] = ',';
                                /* Parse until next comma. */
                                str = strtok_r(NULL, RTE_KVARGS_PAIRS_DELIM, &ctx1);