summaryrefslogtreecommitdiffstats
path: root/net/ipv4/arp.c
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-07-30 01:46:59 +0200
committerDavid S. Miller <davem@davemloft.net>2009-07-30 22:27:29 +0200
commita3e8ee682003685b8b9c98c89340a42e48c3e813 (patch)
tree11d1c94289aa4c4aa668b3df6bd121d9eb76acdc /net/ipv4/arp.c
parent3c515: Write outside array bounds (diff)
downloadlinux-a3e8ee682003685b8b9c98c89340a42e48c3e813.tar.xz
linux-a3e8ee682003685b8b9c98c89340a42e48c3e813.zip
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/ipv4/arp.c')
-rw-r--r--net/ipv4/arp.c4
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