From 1bff06e0544732db44d6c093c74b48b9960f403d Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 11 Mar 2020 13:36:39 +0000 Subject: adjust error check of initial call to vsnprintf() to account for the fact that we always add 1 --- asprintf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asprintf.h b/asprintf.h index acec2b1..10c1dd7 100644 --- a/asprintf.h +++ b/asprintf.h @@ -11,7 +11,7 @@ static inline int vasprintf(char **strp, const char *fmt, va_list ap) va_copy(cp, ap); int len = vsnprintf(NULL, 0, fmt, ap) + 1; - if (len < 0) { + if (len <= 0) { return -1; } -- cgit v1.2.1