shithub: scc

Download patch

ref: 505a92789652dbfa4cf19dc088eb29a47eb6e81f
parent: c47ff0a1a12dbf6ebeb5aac05d0811ef1e1a0455
author: Hiltjo Posthuma <hiltjo@codemadness.org>
date: Mon Apr 3 15:50:06 EDT 2017

[libc] Fix uninitialized counter in vfprintf

found by cppcheck

--- a/libc/src/vfprintf.c
+++ b/libc/src/vfprintf.c
@@ -34,10 +34,10 @@
 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++) {