diff options
author | 2017-04-05 13:35:18 +0000 | |
---|---|---|
committer | 2017-04-05 13:35:18 +0000 | |
commit | c8915b1edf5f30c94370b39ef5a776c42cbfbf9a (patch) | |
tree | 8ff4ca357a97a3ad425e6d951db7c87e4425f249 /sys/netinet/tcp_usrreq.c | |
parent | Add Home and End for copy mode. (diff) | |
download | wireguard-openbsd-c8915b1edf5f30c94370b39ef5a776c42cbfbf9a.tar.xz wireguard-openbsd-c8915b1edf5f30c94370b39ef5a776c42cbfbf9a.zip |
When building counter memory in preparation to copy to userland, always
zero the buffers first. All the current objects appear to be safe,
however future changes might introduce structure pads.
Discussed with guenther, ok bluhm
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 272f4ebcd4a..ba38eb76eae 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.146 2017/04/02 12:56:39 jca Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.147 2017/04/05 13:35:18 deraadt Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -833,6 +833,7 @@ tcp_sysctl_tcpstat(void *oldp, size_t *oldlenp, void *newp) #define ASSIGN(field) do { tcpstat.field = counters[i++]; } while (0) + memset(&tcpstat, 0, sizeof tcpstat); counters_read(tcpcounters, counters, nitems(counters)); ASSIGN(tcps_connattempt); ASSIGN(tcps_accepts); |