commit | 8e31681c5a5a2fd6bbdf751bcc900a4481e2fa29 | [log] [tgz] |
---|---|---|
author | Simon Glass <sjg@chromium.org> | Tue Dec 29 05:22:46 2015 -0700 |
committer | Simon Glass <sjg@chromium.org> | Wed Jan 20 19:06:22 2016 -0700 |
tree | 342441dd9382f84f8e1fd52c089ba394b378a97f | |
parent | 9ab401ae0eb0386e300f24262c3b9178892769aa [diff] [blame] |
tiny-printf: Avoid printing NULL strings Add a check for NULL strings to avoid printing junk to the console. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
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 @@ w--; while (w-- > 0) putc(lz ? '0' : ' '); - while ((ch = *p++)) - putc(ch); + if (p) { + while ((ch = *p++)) + putc(ch); + } } }