Skip to contentSkip to conversation

examples/exception_path: fix possible out-of-bounds read

PATCH Applied Bruce Richardson 2 participants 2 messages Jul 16, 2018 – Jul 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/exception_path: fix possible out-of-bounds read

When printing out stats from the exception_path app, all possible lcore_ids are iterated. However, the app only supports up to 64 cores. To prevent possible errors, and to remove coverity warnings, explicitly check for out-of-range lcore ids before printing.

Coverity issue: 268335

Fixes af75078fece3 ("first public release")
---
 examples/exception_path/main.c | 3 +++
 1 file changed, 3 insertions(+)
examples/exception_path/main.c +3 -0
index 0b59f6b3f..440422bc8 100644
@@ -131,6 +131,9 @@ print_stats(void)
 	       " Lcore    Port            RX            TX    Dropped on TX\n"
 	       "-------  ------  ------------  ------------  ---------------\n");
 	RTE_LCORE_FOREACH(i) {
+		/* limit ourselves to application supported cores only */
+		if (i >= APP_MAX_LCORE)
+			break;
 		printf("%6u %7u %13"PRIu64" %13"PRIu64" %16"PRIu64"\n",
 		       i, (unsigned)port_ids[i],
 		       lcore_stats[i].rx, lcore_stats[i].tx,
Signature · 1 line
2.17.1
#1 lore raw

16/07/2018 18:03, Bruce Richardson:

Quoted 10 lines

When printing out stats from the exception_path app, all possible lcore_ids are iterated. However, the app only supports up to 64 cores. To prevent possible errors, and to remove coverity warnings, explicitly check for out-of-range lcore ids before printing.

Coverity issue: 268335

Fixes af75078fece3 ("first public release")

Applied, thanks