Skip to content

Commit f585a99

Browse files
Jerry Snitselaardavem330
Jerry Snitselaar
authored andcommitted
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: Jerry Snitselaar <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 64d2c22 commit f585a99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/fib_trie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ static void trie_show_stats(struct seq_file *seq, struct trie_stat *stat)
21332133
max--;
21342134

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

0 commit comments

Comments
 (0)