diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2009-09-18 23:32:14 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2009-09-18 23:32:14 +0000 |
commit | b1dfa5a428dd7df6be73509c792b105b5cdcc7e0 (patch) | |
tree | 5557cf822d9389258a548692bb9661ca3544ac84 /lib/libpcap | |
parent | 17f7e14a8721c70a8583cf5bdf473249152ee3c9 (diff) |
Zero out IPv6 mask before using it. This fixes expressions like
'net 2002::/16', which were previously non-deterministic based on
the previous contents of memory.
from upstream; ok claudio@
Diffstat (limited to 'lib/libpcap')
-rw-r--r-- | lib/libpcap/gencode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libpcap/gencode.c b/lib/libpcap/gencode.c index fb540a95f23..9a5297ffd5b 100644 --- a/lib/libpcap/gencode.c +++ b/lib/libpcap/gencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencode.c,v 1.31 2008/06/15 02:49:14 deraadt Exp $ */ +/* $OpenBSD: gencode.c,v 1.32 2009/09/18 23:32:13 bluhm Exp $ */ /* * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 @@ -2437,6 +2437,7 @@ gen_mcode6(s1, s2, masklen, q) if (sizeof(mask) * 8 < masklen) bpf_error("mask length must be <= %u", (unsigned int)(sizeof(mask) * 8)); + memset(&mask, 0, sizeof(mask)); memset(&mask, 0xff, masklen / 8); if (masklen % 8) { mask.s6_addr[masklen / 8] = |