summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorroel kluin <roel.kluin@gmail.com>2009-07-29 23:46:59 +0000
committerDavid S. Miller <davem@davemloft.net>2009-07-30 13:27:29 -0700
commita3e8ee682003685b8b9c98c89340a42e48c3e813 (patch)
tree11d1c94289aa4c4aa668b3df6bd121d9eb76acdc /net
parent3d54015b750e5d5e950a1dcee2735387fd4b6e1a (diff)
downloadop-kernel-dev-a3e8ee682003685b8b9c98c89340a42e48c3e813.zip
op-kernel-dev-a3e8ee682003685b8b9c98c89340a42e48c3e813.tar.gz
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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index c29d75d..090e999 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
OpenPOWER on IntegriCloud