Skip to contentSkip to conversation

Fix potential array overrun in act_to_str

PATCH New Eric Sandeen 1 participant 1 message Dec 16, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/10 Fix potential array overrun in act_to_str

The acts[] array is only N_ACTS elements, so we should not ever set acts[N_ACTS]

---

blkrawverify.c +1 -1
index b6ceb9d..4638eb7 100644
@@ -87,7 +87,7 @@ static char *act_to_str(__u32 action)
 	unsigned int act = action & 0xffff;
 	unsigned int trace = (action >> BLK_TC_SHIFT) & 0xffff;
 
-	if (act <= N_ACTS) {
+	if (act < N_ACTS) {
 		sprintf(buf, "%s ", acts[act].string);
 		for (i = 0; i < N_TRACES; i++)
 			if (trace & (1 << i)) {