diff options
author | 2015-02-12 13:06:47 +0000 | |
---|---|---|
committer | 2015-02-12 13:06:47 +0000 | |
commit | 48065f837447538058867b577071f81042529097 (patch) | |
tree | d875010bfda48a2858e949d793fa181d4a964951 | |
parent | Do not confuse .Bl -column lists that just broken another block (diff) | |
download | wireguard-openbsd-48065f837447538058867b577071f81042529097.tar.xz wireguard-openbsd-48065f837447538058867b577071f81042529097.zip |
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
-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; |