Skip to contentSkip to conversation

fix for potential integer overflow in zoran driver

PATCH Dave Jones 1 participant 1 message Apr 13, 2004 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dave Jones

author
#1 lore raw
Quoted 13 lines · Linux Kernel

ChangeSet 1.2126, 2004/04/12 15:02:37-07:00, [email protected]

[PATCH] fix for potential integer overflow in zoran driver

From: "Ronald S. Bultje" <[email protected]>

Attached patch fixes a potential integer overflow in zoran_procs.c (part of the zr36067 driver). Bug was detected by Ken Ashcraft with the Stanford checker.

drivers/media/video/zoran_procfs.c line 213

Quoted 10 lines
drivers/media/video/zoran_procfs.c +4 -0
@@ -204,6 +204,10 @@
 	char *line, *ldelim, *varname, *svar, *tdelim;
 	struct zoran *zr;
 
+	/* Random maximum */
+	if (count > 256)
+		return -EINVAL;
+
 	zr = (struct zoran *) data;
 
 	string = sp = vmalloc(count + 1);

2.4 already had this fixed, but uses a somewhat larger value to clip at. For uniformity sake, perhaps they should be the same ?
Patch below makes it match 2.4-bk

Dave

drivers/media/video/zoran_procfs.c renamed from drivers/media/video/zoran_procfs.c~ +1 -2
@@ -204,8 +204,7 @@
 	char *line, *ldelim, *varname, *svar, *tdelim;
 	struct zoran *zr;
 
-	/* Random maximum */
-	if (count > 256)
+	if (count > 32768)	/* Stupidity filter */
 		return -EINVAL;
 
 	zr = (struct zoran *) data;