commit f72c50b215daa8a5262439c0e070d5ce012041de
parent 8a4b0a84f0f570f77c519de976244a695577854b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 3 Apr 2017 19:50:06 +0200
[libc] Fix uninitialized counter in vfprintf
found by cppcheck
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/src/vfprintf.c b/libc/src/vfprintf.c
@@ -34,10 +34,10 @@ printn(FILE * restrict fp, int n, int b, int sign)
int
vfprintf(FILE * restrict fp, const char *fmt, va_list va)
{
- int c, base, sign, cnt;
+ int c, base, sign, cnt = 0;
char *s;
- while (( c = *fmt++) != '\0') {
+ while ((c = *fmt++) != '\0') {
if (c == '%') {
sign = 0;
switch (*fmt++) {