DragonFlyBSD Kernel Audit
DF-0112 / fix.diff
← back to finding ↓ download raw
diff --git a/kern/subr_scanf.c b/kern/subr_scanf.c
--- a/kern/subr_scanf.c
+++ b/kern/subr_scanf.c
@@ -609,9 +609,9 @@
 			}
 			fmt++;
 			/* fill in the range */
-			do {
+			while (c < n) {
 			    tab[++c] = v;
-			} while (c < n);
+			}
 			c = n;
 			/*
 			 * Alas, the V7 Unix scanf also treats formats