From 6ce38b73956836c26c8914cdf5002da7900a5d2d Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 28 Jun 2019 05:44:09 +0000 Subject: 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 --- xmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xmalloc.c') diff --git a/xmalloc.c b/xmalloc.c index 22ea3540..f249e397 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -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; -- cgit