[PATCH v2 14/16] app/testpmd: verify strdup return value
    lihuisong (C) 
    lihuisong at huawei.com
       
    Tue Nov 21 04:32:05 CET 2023
    
    
  
Acked-by: Huisong Li <lihuisong at 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: stable at dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen at 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);
    
    
More information about the dev
mailing list