Fix allocation size in vaswprintf

This is so embarrassing. It only started crashing once it had strings
that were long enough, and then it took me so long to notice this
mistake. I was worried I was still doing va_list wrong somehow.
weechat-hashes
Curtis McEnroe 2018-08-06 22:08:57 -04:00
parent 3f3fa34d8a
commit 1c2b038396
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 1 additions and 1 deletions

2
pls.c
View File

@ -47,7 +47,7 @@ int vaswprintf(wchar_t **ret, const wchar_t *format, va_list ap) {
*ret = NULL;
for (size_t cap = 2 * wcslen(format);; cap *= 2) {
wchar_t *buf = realloc(*ret, 1 + cap);
wchar_t *buf = realloc(*ret, sizeof(*buf) * (1 + cap));
if (!buf) goto fail;
*ret = buf;