Skip to contentSkip to conversation

cyclades: fix read buffer overflow

PATCH New [email protected] 1 participant 1 message Sep 18, 2009

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

PATCH 3/5 cyclades: fix read buffer overflow

From: Roel Kluin <[email protected]>

irq is declared with size NR_CARDS (4), but the loop containing this segment runs up until NR_ISA_ADDRS (16), possibly reading from irq[i] (and trying to use the result)

Identified by the Parfait static scanner.

---

 drivers/char/cyclades.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/cyclades.c renamed from drivers/char/cyclades.c~cyclades-read-buffer-overflow +1 -1
diff -puN drivers/char/cyclades.c~cyclades-read-buffer-overflow drivers/char/cyclades.c
@@ -3354,7 +3354,7 @@ static int __init cy_detect_isa(void)
 			continue;
 		}
 #ifdef MODULE
-		if (isparam && irq[i])
+		if (isparam && i < NR_CARDS && irq[i])
 			cy_isa_irq = irq[i];
 		else
 #endif

_