Skip to contentSkip to conversation

Overrun in drivers/input/joystick/db9.c

PATCH Applied Eric Sesterhenn 2 participants 2 messages Jun 27, 2006 – Jun 28, 2006 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Overrun in drivers/input/joystick/db9.c

hi,

coverity spotted this overrun (#id 483), we assign db9_mode = &db9_modes[mode]; some lines before, so if we use mode as index again we might get past the array once mode is greater than DB9_MAX_PAD/2, besides this this patch changes the code to what the author possibly intended it to do.

drivers/input/joystick/db9.c renamed from drivers/input/joystick/db9.c.orig +1 -1
@@ -584,7 +584,7 @@ static struct db9 __init *db9_probe(int 
 		goto err_out;
 	}
 
-	if (db9_mode[mode].bidirectional && !(pp->modes & PARPORT_MODE_TRISTATE)) {
+	if (db9_mode->bidirectional && !(pp->modes & PARPORT_MODE_TRISTATE)) {
 		printk(KERN_ERR "db9.c: specified parport is not bidirectional\n");
 		err = -EINVAL;
 		goto err_put_pp;
#1 lore raw
Quoted 9 lines · Eric Sesterhenn

hi,

coverity spotted this overrun (#id 483), we assign db9_mode = &db9_modes[mode]; some lines before, so if we use mode as index again we might get past the array once mode is greater than DB9_MAX_PAD/2, besides this this patch changes the code to what the author possibly intended it to do.

Applied, thank you.

Signature · 1 line
Dmitry