Skip to contentSkip to conversation

Overrun in isdn_tty.c

PATCH New Eric Sesterhenn / Snakebyte 1 participant 1 message May 16, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Overrun in isdn_tty.c

hi,

this fixes coverity bug id #1237. After the while loop, it is possible for i == ISDN_LMSNLEN. If this happens the terminating '\0' is written after the end of the array.

drivers/isdn/i4l/isdn_tty.c renamed from drivers/isdn/i4l/isdn_tty.c.orig +1 -1
@@ -2880,7 +2880,7 @@ isdn_tty_cmd_ATand(char **p, modem_info 
 			p[0]++;
 			i = 0;
 			while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) &&
-			       (i < ISDN_LMSNLEN))
+			       (i < ISDN_LMSNLEN - 1))
 				m->lmsn[i++] = *p[0]++;
 			m->lmsn[i] = '\0';
 			break;