From: John Hodge (sonata) Date: Fri, 30 Nov 2012 06:49:37 +0000 (+0800) Subject: Kernel/libc - Fixed infinite loop in vsnprintf X-Git-Tag: rel0.15~629 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=f64e0f5e295394f2e75900e6c92b1d347f62f59d;p=tpg%2Facess2.git Kernel/libc - Fixed infinite loop in vsnprintf --- diff --git a/KernelLand/Kernel/libc.c b/KernelLand/Kernel/libc.c index 8674650b..67ce9b2e 100644 --- a/KernelLand/Kernel/libc.c +++ b/KernelLand/Kernel/libc.c @@ -363,7 +363,7 @@ int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args) if(!p) p = "(null)"; len = strlen(p); if( !bPadLeft ) while(len++ < minSize) PUTCH(pad); - while(*p && precision--) PUTCH(*p++); + while(*p && precision--) { PUTCH(*p); p++;} if( bPadLeft ) while(len++ < minSize) PUTCH(pad); break; @@ -371,7 +371,10 @@ int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args) p = va_arg(args, char*); if( !CheckMem(p, minSize) ) continue; // No #PFs please if(!p) goto printString; - while(minSize--) PUTCH(*p++); + while(minSize--) { + PUTCH(*p); + p ++; + } break; // Single Character