Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f585a991 authored by Jerry Snitselaar's avatar Jerry Snitselaar Committed by David S. Miller
Browse files

fib_trie: potential out of bounds access in trie_show_stats()



With the <= max condition in the for loop, it will be always go 1
element further than needed. If the condition for the while loop is
never met, then max is MAX_STAT_DEPTH, and for loop will walk off the
end of nodesizes[].

Signed-off-by: default avatarJerry Snitselaar <jerry.snitselaar@oracle.com>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 64d2c22a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2133,7 +2133,7 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
		max--;

	pointers = 0;
	for (i = 1; i <= max; i++)
	for (i = 1; i < max; i++)
		if (stat->nodesizes[i] != 0) {
			seq_printf(seq, "  %u: %u",  i, stat->nodesizes[i]);
			pointers += (1<<i) * stat->nodesizes[i];