runtime: correct the asprintf shim for Windows

Ensure that the string that is formed from the `asprintf` call is
null-terminated.  The `_vsnprintf` call will not null-terminate the
string if the length is not sufficient.
This commit is contained in:
Saleem Abdulrasool
2020-07-14 20:01:12 -07:00
parent 103961a7d5
commit 37ee73cda9

View File

@@ -56,6 +56,7 @@ int asprintf(char **strp, const char *fmt, ...) {
return -1;
length = _vsnprintf(*strp, length, fmt, argp1);
(*strp)[length] = '\0';
va_end(argp0);
va_end(argp1);