summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-10-28 00:36:17 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2010-10-28 00:36:17 (GMT)
commitdb9ccc57728ccc7ca3c949437828e3d6d9d2dc5d (patch)
tree47368929e7a09be02a14272784157df3aa410daa
parent9ce642f9746dfc29d119d0680b769677e3ea6da6 (diff)
downloadbusybox-db9ccc57728ccc7ca3c949437828e3d6d9d2dc5d.tar.gz
busybox-db9ccc57728ccc7ca3c949437828e3d6d9d2dc5d.tar.bz2
netstat: was using buffers one byte short for scanf (no place for NUL). fixing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/netstat.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/networking/netstat.c b/networking/netstat.c
index 485a7d1..2a83af3 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -395,11 +395,14 @@ struct inet_params {
static int scan_inet_proc_line(struct inet_params *param, char *line)
{
int num;
- char local_addr[64], rem_addr[64];
+ /* IPv6 /proc files use 32-char hex representation
+ * of IPv6 address, followed by :PORT_IN_HEX
+ */
+ char local_addr[33], rem_addr[33]; /* 32 + 1 for NUL */
num = sscanf(line,
- "%*d: %64[0-9A-Fa-f]:%X "
- "%64[0-9A-Fa-f]:%X %X "
+ "%*d: %32[0-9A-Fa-f]:%X "
+ "%32[0-9A-Fa-f]:%X %X "
"%lX:%lX %*X:%*X "
"%*X %d %*d %ld ",
local_addr, &param->local_port,