* [dpdk-dev] [PATCH] table: fix out of bounds write
@ 2021-04-07 10:59 Cristian Dumitrescu
2021-04-19 17:51 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Cristian Dumitrescu @ 2021-04-07 10:59 UTC (permalink / raw)
To: dev
Fix out of bounds write. The allocated string size was incorrect.
Coverity issue: 369670
Fixes: 66440b7b22f2 ("table: add wildcard match table type")
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
lib/librte_table/rte_swx_table_wm.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/librte_table/rte_swx_table_wm.c b/lib/librte_table/rte_swx_table_wm.c
index 9924231b3..e260be106 100644
--- a/lib/librte_table/rte_swx_table_wm.c
+++ b/lib/librte_table/rte_swx_table_wm.c
@@ -53,15 +53,14 @@ env_free(void *start, size_t size)
static char *get_unique_name(void)
{
- char *name;
- uint64_t *tsc;
+ uint64_t tsc = rte_get_tsc_cycles();
+ size_t size = sizeof(uint64_t) * 2 + 1;
+ char *name = calloc(1, size);
- name = calloc(7, 1);
if (!name)
return NULL;
- tsc = (uint64_t *) name;
- *tsc = rte_get_tsc_cycles();
+ snprintf(name, size, "%016" PRIx64, tsc);
return name;
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-19 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 10:59 [dpdk-dev] [PATCH] table: fix out of bounds write Cristian Dumitrescu
2021-04-19 17:51 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).