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.
This commit is contained in:
FRIGN 2015-12-21 13:57:10 +01:00 committed by sin
parent 3b1b50cffa
commit e40fc2b176

View File

@ -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);