[PATCH] test/argparse: fix out of bound memcpy
fengchengwen
fengchengwen at huawei.com
Mon Jul 7 06:12:52 CEST 2025
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
On 2025/6/28 0:22, Stephen Hemminger wrote:
> The rte_argparse API use variable length arrays for the args.
> But the test was only putting space on stack for the argparse
> part, not the args. This can lead to out of bounds writes.
>
> The bug only gets detected if DPDK is compiled with LTO.
> In function ‘test_argparse_copy’,
> inlined from ‘test_argparse_init_obj’ at ../app/test/test_argparse.c:108:2,
> inlined from ‘test_argparse_opt_callback_parse_int_of_no_val’ at ../app/test/test_argparse.c:490:8:
> ../app/test/test_argparse.c:96:17: warning: ‘memcpy’ writing 56 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
> 96 | memcpy(&dst->args[i], &src->args[i], sizeof(src->args[i]));
>
> Fixes: 6c5c6571601c ("argparse: verify argument config")
> Cc: fengchengwen at huawei.com
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list