From 55fc64c7ffd7792bc88451a736c2e94e5865282f Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 17 Aug 2020 15:39:58 -0400 Subject: fix overflow that messes up numbers with 0 in them --- src/stdio/__printf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdio/__printf.c b/src/stdio/__printf.c index ad266e2c..0429d5bf 100644 --- a/src/stdio/__printf.c +++ b/src/stdio/__printf.c @@ -51,7 +51,7 @@ static void __itos(char *s, intmax_t n, int flags, int precision, int base) extern int toupper(int); char digits[] = "0123456789abcdef"; char sign = n < 0 ? '-' : '+'; - char buf[NUMBUFLEN]; + char buf[NUMBUFLEN + 1]; char *out = buf + NUMBUFLEN; if (flags & UPPER && base > 10) { size_t i; -- cgit v1.2.1