[winpr,crt] fix off by one in winpr_vasprintf

This commit is contained in:
akallabeth 2024-11-13 21:03:41 +01:00
parent 16657adf60
commit 0b8de6f4b5
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -199,12 +199,12 @@ int winpr_vasprintf(char** s, size_t* slen, WINPR_FORMAT_ARG const char* templ,
if (length < 0)
return length;
char* str = calloc((size_t)length + 1ul, sizeof(char));
char* str = calloc((size_t)length + 1UL, sizeof(char));
if (!str)
return -1;
va_copy(ap, oap);
const int plen = vsnprintf(str, (size_t)length, templ, ap);
const int plen = vsnprintf(str, (size_t)length + 1UL, templ, ap);
va_end(ap);
if (length != plen)