Jelajahi Sumber

Fix stack overflow in _ppfs_parsespec

Carmelo Amoroso 17 tahun lalu
induk
melakukan
fac054e086
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      libc/stdio/_vfprintf.c

+ 1 - 1
libc/stdio/_vfprintf.c

@@ -898,7 +898,7 @@ int attribute_hidden _ppfs_parsespec(ppfs_t *ppfs)
 				) {
 				return -1;
 			}
-		} while (buf[i++]);
+		} while (buf[i++] && (i < sizeof(buf)));
 		buf[sizeof(buf)-1] = 0;
 	}
 #else  /* __UCLIBC_HAS_WCHAR__ */