diff options
author | dzwdz | 2021-10-10 15:36:53 +0000 |
---|---|---|
committer | dzwdz | 2021-10-10 15:36:53 +0000 |
commit | ac2252793a6e2a380bd215f62291ca2fe4f973b2 (patch) | |
tree | 9708f1e2ad3961f360cf509ee437d258134e16c2 /src/init | |
parent | ba69471edd732efa8a9b435299b82bfc482e0756 (diff) |
init/printf: allow passing a nullptr to %s
Diffstat (limited to 'src/init')
-rw-r--r-- | src/init/stdlib.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/init/stdlib.c b/src/init/stdlib.c index a60854b..4bc90d2 100644 --- a/src/init/stdlib.c +++ b/src/init/stdlib.c @@ -39,8 +39,10 @@ int printf(const char *fmt, ...) { switch (c) { case 's': const char *s = va_arg(argp, char*); - _syscall_write(0, s, strlen(s), 0); - total += strlen(s); + if (s) { + _syscall_write(0, s, strlen(s), 0); + total += strlen(s); + } break; case 'x': |