From e40fc2b17676145087f62e66940d8aceccb793b5 Mon Sep 17 00:00:00 2001 From: FRIGN Date: Mon, 21 Dec 2015 13:57:10 +0100 Subject: [PATCH] Check argv0 in xvprintf() You never know, given printf'ing NULL-strings might crash the program, we shouldn't just pass argv0 blindly to it. --- libutil/eprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutil/eprintf.c b/libutil/eprintf.c index 6230c66..673523e 100644 --- a/libutil/eprintf.c +++ b/libutil/eprintf.c @@ -47,7 +47,7 @@ weprintf(const char *fmt, ...) void xvprintf(const char *fmt, va_list ap) { - if (strncmp(fmt, "usage", strlen("usage"))) + if (argv0 && strncmp(fmt, "usage", strlen("usage"))) fprintf(stderr, "%s: ", argv0); vfprintf(stderr, fmt, ap);