asprintf returns -1, not an arbitrary value < 0. Also upon error the

(very sloppy specification) leaves an undefined value in *ret, so it is
wrong to inspect it, the error condition is enough.
discussed a little with nicm, and then much more with millert until we
were exasperated
This commit is contained in:
deraadt 2019-06-28 05:44:09 +00:00
parent b434692db2
commit 6ce38b7395

View File

@ -111,7 +111,7 @@ xvasprintf(char **ret, const char *fmt, va_list ap)
i = vasprintf(ret, fmt, ap);
if (i < 0 || *ret == NULL)
if (i == -1)
fatalx("xasprintf: %s", strerror(errno));
return i;