diff options
author | roel kluin <roel.kluin@gmail.com> | 2009-07-29 23:46:59 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-30 13:27:29 -0700 |
commit | a3e8ee682003685b8b9c98c89340a42e48c3e813 (patch) | |
tree | 11d1c94289aa4c4aa668b3df6bd121d9eb76acdc /net | |
parent | 3d54015b750e5d5e950a1dcee2735387fd4b6e1a (diff) |
ipv4: ARP neigh procfs buffer overflow
If arp_format_neigh_entry() can be called with n->dev->addr_len == 0, then a
write to hbuffer[-1] occurs.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/arp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index c29d75d8f1b1..090e9991ac2a 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -1304,7 +1304,9 @@ static void arp_format_neigh_entry(struct seq_file *seq, hbuffer[k++] = hex_asc_lo(n->ha[j]); hbuffer[k++] = ':'; } - hbuffer[--k] = 0; + if (k != 0) + --k; + hbuffer[k] = 0; #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) } #endif |