diff options
author | 2003-10-01 21:21:35 +0000 | |
---|---|---|
committer | 2003-10-01 21:21:35 +0000 | |
commit | a5cd285434f2218b4d287704af42a2e4bc138d34 (patch) | |
tree | 850942d59976d2eccdedca146bb4455e51d23229 | |
parent | Compile kernel and bootblocks with -mmemcpy, to get rid of libgcc dependancy. (diff) | |
download | wireguard-openbsd-a5cd285434f2218b4d287704af42a2e4bc138d34.tar.xz wireguard-openbsd-a5cd285434f2218b4d287704af42a2e4bc138d34.zip |
Fix stack leak into pfloghdr (the pad field is not initialized),
which ends up in the pflog pcap file. From dhartmei@
ok dhartmei@, frantzen@, henning@
-rw-r--r-- | sys/net/if_pflog.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c index e856f2cc965..9def6c6371a 100644 --- a/sys/net/if_pflog.c +++ b/sys/net/if_pflog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflog.c,v 1.9 2003/05/14 08:42:00 canacar Exp $ */ +/* $OpenBSD: if_pflog.c,v 1.10 2003/10/01 21:21:35 canacar Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -184,6 +184,7 @@ pflog_packet(struct ifnet *ifp, struct mbuf *m, sa_family_t af, u_int8_t dir, if (ifp == NULL || m == NULL || rm == NULL) return (-1); + bzero(&hdr, sizeof(hdr)); hdr.length = PFLOG_REAL_HDRLEN; hdr.af = af; hdr.action = rm->action; @@ -193,13 +194,10 @@ pflog_packet(struct ifnet *ifp, struct mbuf *m, sa_family_t af, u_int8_t dir, if (am == NULL) { hdr.rulenr = htonl(rm->nr); hdr.subrulenr = -1; - bzero(hdr.ruleset, sizeof(hdr.ruleset)); } else { hdr.rulenr = htonl(am->nr); hdr.subrulenr = htonl(rm->nr); - if (ruleset == NULL) - bzero(hdr.ruleset, sizeof(hdr.ruleset)); - else + if (ruleset != NULL) memcpy(hdr.ruleset, ruleset->name, sizeof(hdr.ruleset)); |