diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2015-02-12 13:06:48 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2015-02-12 13:06:48 +0000 |
commit | 4011bd631345903a1c9c6cd0ef9000e32e777c91 (patch) | |
tree | 65d30f12d3bd4fa4ba448f6e2cbf4aea1d7a1ac0 /usr.bin/netstat | |
parent | 47f62b8db5df6c72c4d691f157a6053c41177512 (diff) |
Initialize buffer pointers passed to get_sysctl to NULL; otherwise they point
to random memory so when the sysctl-estimate is too small, the realloc() fails.
Problem reported by Ze Loff, ok claudio
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r-- | usr.bin/netstat/if.c | 4 | ||||
-rw-r--r-- | usr.bin/netstat/mroute6.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index d9a440b87ff..1d0161ed09b 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.72 2015/02/09 12:25:03 claudio Exp $ */ +/* $OpenBSD: if.c,v 1.73 2015/02/12 13:06:47 sthen Exp $ */ /* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */ /* @@ -503,7 +503,7 @@ fetchifs(void) struct if_data *ifd; struct sockaddr *sa, *rti_info[RTAX_MAX]; struct sockaddr_dl *sdl; - char *buf, *next, *lim; + char *buf = NULL, *next, *lim; char name[IFNAMSIZ]; size_t len; int takeit = 0; diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c index d841fc1450a..c36602192b7 100644 --- a/usr.bin/netstat/mroute6.c +++ b/usr.bin/netstat/mroute6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mroute6.c,v 1.17 2015/02/09 12:25:03 claudio Exp $ */ +/* $OpenBSD: mroute6.c,v 1.18 2015/02/12 13:06:47 sthen Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -84,7 +84,7 @@ void mroute6pr(void) { - char *buf; + char *buf = NULL; char fmtbuf[FMT_SCALED_STRSIZE]; struct mf6cinfo *mfc; struct mif6info *mif; |