Report an error upon string_new_format(NULL)

This commit is contained in:
Pierre Pronchery 2017-04-17 05:47:45 +02:00
parent bd413de612
commit 0ad485a8c3

View File

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