Acked-by: Huisong Li <lihuis...@huawei.com>
在 2023/11/10 18:01, Chengwen Feng 写道:
Add verify strdup return value logic.
Fixes: 52e2e7edcf48 ("app/testpmd: add protocol-based buffer split")
Cc: sta...@dpdk.org
Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
---
app/test-pmd/cmdline.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 912bf3355c..904c04d466 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3528,6 +3528,8 @@ parse_hdrs_list(const char *str, const char *item_name,
unsigned int max_items,
nb_item = 0;
char *str2 = strdup(str);
+ if (str2 == NULL)
+ return nb_item;
cur = strtok_r(str2, ",", &tmp);
while (cur != NULL) {
parsed_items[nb_item] = get_ptype(cur);