Skip to contentSkip to conversation

Prevent reading uninitialized memory with socket filters

PATCH New Dan Rosenberg 1 participant 1 message Nov 9, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Prevent reading uninitialized memory with socket filters

As requested, avoiding the memset.

net/core/filter.c +1 -1
diff -urp a/net/core/filter.c b/net/core/filter.c
@@ -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;