From: John Hodge Date: Sun, 9 Feb 2014 14:35:35 +0000 (+0800) Subject: Kernel/libc - Replace invalid '%C' strings with "(inval)" X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=91cb22a5f21eeca8f84456c1febf79f84a65d30d;p=tpg%2Facess2.git Kernel/libc - Replace invalid '%C' strings with "(inval)" --- diff --git a/KernelLand/Kernel/libc.c b/KernelLand/Kernel/libc.c index d42e5249..2e08a17c 100644 --- a/KernelLand/Kernel/libc.c +++ b/KernelLand/Kernel/libc.c @@ -391,13 +391,20 @@ int vsnprintf(char *__s, const size_t __maxlen, const char *__format, va_list ar case 'C': // Non-Null Terminated Character Array p = va_arg(args, char*); - if( !CheckMem(p, minSize) ) continue; // No #PFs please + if( !CheckMem(p, minSize) ) { + p = "(inval)"; + goto printString; + } if(!p) goto printString; while(minSize--) { if(*p == '\0') { PUTCH('\\'); PUTCH('0'); } + else if(*p == '\\') { + PUTCH('\\'); + PUTCH('\\'); + } else { PUTCH(*p); }