From: Pallantla Poornima Date: Tue, 26 Mar 2019 10:27:23 +0000 (+0000) Subject: test/hash: replace sprintf with snprintf X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8766e2a4782aecb6d474697617055e281149cc02;p=dpdk.git test/hash: replace sprintf with snprintf sprintf function is not secure as it doesn't check the length of string. More secure function snprintf is used. Fixes: 473d1bebce ("hash: allow to store data in hash table") Cc: stable@dpdk.org Signed-off-by: Pallantla Poornima Acked-by: Yipeng Wang --- diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c index 5252111803..5648fce023 100644 --- a/app/test/test_hash_perf.c +++ b/app/test/test_hash_perf.c @@ -85,9 +85,11 @@ create_table(unsigned int with_data, unsigned int table_index, if (with_data) /* Table will store 8-byte data */ - sprintf(name, "test_hash%d_data", hashtest_key_lens[table_index]); + snprintf(name, sizeof(name), "test_hash%u_data", + hashtest_key_lens[table_index]); else - sprintf(name, "test_hash%d", hashtest_key_lens[table_index]); + snprintf(name, sizeof(name), "test_hash%u", + hashtest_key_lens[table_index]); if (with_locks)