DragonFlyBSD Kernel Audit
DF-1732 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/vinum/vinumio.c b/sys/dev/raid/vinum/vinumio.c
--- a/sys/dev/raid/vinum/vinumio.c
+++ b/sys/dev/raid/vinum/vinumio.c
@@ -793,10 +793,12 @@
 	else {
 	    vinum_conf.drives_used++;			    /* another drive in use */
 	    /* Parse the configuration, and add it to the global configuration */
-	    for (cptr = config_text; *cptr != '\0';) {	    /* love this style(9) */
+	    for (cptr = config_text; *cptr != '\0' &&
+		 cptr < config_text + MAXCONFIG * 2;) {	    /* love this style(9) */
 		volatile int parse_status;		    /* return value from parse_config */
 
-		for (eptr = config_line; (*cptr != '\n') && (*cptr != '\0');) /* until the end of the line */
+		for (eptr = config_line; (*cptr != '\n') && (*cptr != '\0') &&
+		     eptr < config_line + MAXCONFIGLINE * 2 - 1;) /* until end of line */
 		    *eptr++ = *cptr++;
 		*eptr = '\0';				    /* and delimit */
 		if (setjmp(command_fail) == 0) {	    /* come back here on error and continue */