1
0
Fork 0
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:
Solomon Peachy 2024-06-20 15:22:36 -04:00
parent 53a43522a3
commit b4668e2bd6

View file

@ -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 */