From 56e1747d197e1c1a0e928bc9ed4810a73a57dd90 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 15 Jan 2016 00:35:25 +0200 Subject: [PATCH] don't crash on null strings --- loader/llibc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loader/llibc.c b/loader/llibc.c index 3a0205f..c19e11d 100644 --- a/loader/llibc.c +++ b/loader/llibc.c @@ -168,7 +168,9 @@ void g_fprintf(int fd, const char *fmt, ...) if (*s == 'l' || *s == 'z') s++; // ignore for now if (*s == 's') { - char *ns = va_arg(ap, char *); + const char *ns = va_arg(ap, const char *); + if (ns == NULL) + ns = "(null)"; int len = strlen(ns); while (justify > len && left > 1) { *d++ = ' '; -- 2.39.2