
29 Dec
2015
29 Dec
'15
1:22 p.m.
Add a check for NULL strings to avoid printing junk to the console.
Signed-off-by: Simon Glass sjg@chromium.org ---
lib/tiny-printf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 403b134..efe5c25 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -108,8 +108,10 @@ int vprintf(const char *fmt, va_list va) w--; while (w-- > 0) putc(lz ? '0' : ' '); - while ((ch = *p++)) - putc(ch); + if (p) { + while ((ch = *p++)) + putc(ch); + } } }
--
2.6.0.rc2.230.g3dd15c0