Patchwork [v2] Prevent reading uninitialized memory with socket filters

login
register
mail settings
Submitter Dan Rosenberg
Date Nov. 9, 2010, 11:53 p.m.
Message ID <1289346817.7380.16.camel@dan>
Download mbox | patch
Permalink /patch/70592/
State Superseded
Delegated to: David Miller
Headers show

Comments

Dan Rosenberg - Nov. 9, 2010, 11:53 p.m.
As requested, avoiding the memset.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -urp a/net/core/filter.c b/net/core/filter.c
--- a/net/core/filter.c	2010-11-08 22:10:26.820703471 -0500
+++ b/net/core/filter.c	2010-11-09 18:49:33.857201963 -0500
@@ -116,7 +116,7 @@  unsigned int sk_run_filter(struct sk_buf
 	void *ptr;
 	u32 A = 0;			/* Accumulator */
 	u32 X = 0;			/* Index Register */
-	u32 mem[BPF_MEMWORDS];		/* Scratch Memory Store */
+	u32 mem[BPF_MEMWORDS] = {};	/* Scratch Memory Store */
 	u32 tmp;
 	int k;
 	int pc;