From 0ad485a8c35e4ffc0db5706e93d1acd5b7d5ac2d Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 17 Apr 2017 05:47:45 +0200 Subject: [PATCH] Report an error upon string_new_format(NULL) --- src/string.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/string.c b/src/string.c index ffb53f9..c354430 100644 --- a/src/string.c +++ b/src/string.c @@ -76,6 +76,11 @@ String * string_new_format(String const * format, ...) int len; size_t s; + if(format == NULL) + { + error_set_code(-EINVAL, "%s", strerror(EINVAL)); + return NULL; + } va_start(ap, format); len = vsnprintf(NULL, 0, format, ap); va_end(ap);