forked from len0rd/rockbox
libc: Check for a null string argument in *printf
If we are passed a null string argument, use the fixed string "(null)" instead. Change-Id: I4f70ae76cdcac1104ff1e42dc3b1a5f03e2723fe
This commit is contained in:
parent
53a43522a3
commit
b4668e2bd6
1 changed files with 1 additions and 1 deletions
|
@ -511,7 +511,7 @@ static inline const char * format_s(const void *str,
|
|||
return NULL; /* wchar_t support for now */
|
||||
}
|
||||
|
||||
const char *s = str;
|
||||
const char *s = str ? str : "(null)";
|
||||
size_t len;
|
||||
/* string length may be specified by precision instead of \0-
|
||||
terminated; however, don't go past a \0 if one is there */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue