summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-06-20 15:22:36 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-06-20 15:22:36 -0400
commitb4668e2bd68fc700ca027d1c77f69b5be960daa6 (patch)
treea40fa7277ad044b0a96a70956fe22a1a5a44b507
parent53a43522a367b2592e0e1a52383f0326434962d5 (diff)
downloadrockbox-b4668e2bd68fc700ca027d1c77f69b5be960daa6.tar.gz
rockbox-b4668e2bd68fc700ca027d1c77f69b5be960daa6.zip
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
-rw-r--r--firmware/common/vuprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/firmware/common/vuprintf.c b/firmware/common/vuprintf.c
index a040a3f0ac..4f669b2610 100644
--- a/firmware/common/vuprintf.c
+++ b/firmware/common/vuprintf.c
@@ -511,7 +511,7 @@ static inline const char * format_s(const void *str,
511 return NULL; /* wchar_t support for now */ 511 return NULL; /* wchar_t support for now */
512 } 512 }
513 513
514 const char *s = str; 514 const char *s = str ? str : "(null)";
515 size_t len; 515 size_t len;
516 /* string length may be specified by precision instead of \0- 516 /* string length may be specified by precision instead of \0-
517 terminated; however, don't go past a \0 if one is there */ 517 terminated; however, don't go past a \0 if one is there */