Skip to contentSkip to conversation

linux-2.4.19/drivers/ieee1394/video1394.c

PATCH New [email protected] 1 participant 1 message Aug 24, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.4.19/drivers/ieee1394/video1394.c

avoid possible integer overflow

(also change the <= to just != since its using unsigned types anyway making the sign test invalid here *shrug*)

--
Silvio

drivers/ieee1394/video1394.c +2 -2
@@ -871,13 +871,13 @@
 		}
 		ohci->ISO_channel_usage |= mask;
 
-		if (v.buf_size<=0) {
+		if (v.buf_size == 0 || v.buf_size > VIDEO1394_MAX_SIZE) {
 			PRINT(KERN_ERR, ohci->id,
 			      "Invalid %d length buffer requested",v.buf_size);
 			return -EFAULT;
 		}
 
-		if (v.nb_buffers<=0) {
+		if (v.nb_buffers == 0 || v.nb_buffers > VIDEO1394_MAX_SIZE) {
 			PRINT(KERN_ERR, ohci->id,
 			      "Invalid %d buffers requested",v.nb_buffers);
 			return -EFAULT;