Patchwork pcnet32: Read buffer overflow

login
register
mail settings
Submitter roel kluin
Date Aug. 7, 2009, 1:24 p.m.
Message ID <4A7C2B0B.9030508@gmail.com>
Download mbox | patch
Permalink /patch/30934/
State Accepted
Delegated to: David Miller
Headers show

Comments

roel kluin - Aug. 7, 2009, 1:24 p.m.
An `options[cards_found]' that equals `sizeof(options_mapping)' is already beyond
the array.

Signed-off-by: Roel Kluin <roel.kluin@gmail.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
David Miller - Aug. 10, 2009, 4:49 a.m.
From: Roel Kluin <roel.kluin@gmail.com>
Date: Fri, 07 Aug 2009 15:24:27 +0200

> An `options[cards_found]' that equals `sizeof(options_mapping)' is already beyond
> the array.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Applied.
--
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 --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 2836815..7f834a3 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1835,7 +1835,7 @@  pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
 	lp->chip_version = chip_version;
 	lp->msg_enable = pcnet32_debug;
 	if ((cards_found >= MAX_UNITS)
-	    || (options[cards_found] > sizeof(options_mapping)))
+	    || (options[cards_found] >= sizeof(options_mapping)))
 		lp->options = PCNET32_PORT_ASEL;
 	else
 		lp->options = options_mapping[options[cards_found]];