Skip to contentSkip to conversation

fix array overrun in drivers/char/mwave/mwavedd.c

PATCH New Adrian Bunk 1 participant 1 message Apr 23, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix array overrun in drivers/char/mwave/mwavedd.c

From: Eric Sesterhenn <[email protected]>

this fixes coverity id #489.
Since the last element in the array is always ARRAY_SIZE-1 we have to check for ipcnum >= ARRAY_SIZE()

---

This patch was sent by Eric Sesterhenn on:
- 9 Apr 2006

drivers/char/mwave/mwavedd.c renamed from drivers/char/mwave/mwavedd.c.orig +1 -1
@@ -271,7 +271,7 @@ static int mwave_ioctl(struct inode *ino
 				ipcnum,
 				pDrvData->IPCs[ipcnum].usIntCount);
 	
-			if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+			if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
 				PRINTK_ERROR(KERN_ERR_MWAVE
 						"mwavedd::mwave_ioctl:"
 						" IOCTL_MW_REGISTER_IPC:"