From b1dfa5a428dd7df6be73509c792b105b5cdcc7e0 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Fri, 18 Sep 2009 23:32:14 +0000 Subject: 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@ --- lib/libpcap/gencode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libpcap') 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] = -- cgit v1.2.3