Skip to content

Commit 0e75958

Browse files
[do-not-upstream] tinystdio: fix in vfprintf to prevent checking on -ve values of width
before this change, if width is zero code get stuck in an infite loop through negative values of width as it is defined as a signed int. Signed-off-by: Mostafa Salman <[email protected]>
1 parent e7ed690 commit 0e75958

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

newlib/libc/tinystdio/vfprintf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,9 @@ int vfprintf (FILE * stream, const CHAR *fmt, va_list ap_orig)
12491249
base = 2;
12501250
#endif
12511251
} else {
1252-
my_putc('%', stream);
1252+
while (--width > 0) {
1253+
my_putc(' ', stream);
1254+
}
12531255
my_putc(c, stream);
12541256
continue;
12551257
}

0 commit comments

Comments
 (0)