about summary refs log tree commit diff
path: root/pls.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-06 22:08:57 -0400
committerJune McEnroe <june@causal.agency>2018-08-06 22:08:57 -0400
commit1c2b0383960f99f1f9ad88e552588f361040b872 (patch)
tree546e8e0c0cb383e9cea1e57d828a23ed9d03c80b /pls.c
parentImplement word wrapping (diff)
downloadtest-1c2b0383960f99f1f9ad88e552588f361040b872.tar.gz
test-1c2b0383960f99f1f9ad88e552588f361040b872.zip
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.
Diffstat (limited to 'pls.c')
-rw-r--r--pls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pls.c b/pls.c
index c6071c7..7e6570c 100644
--- a/pls.c
+++ b/pls.c
@@ -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;
 
nroe 2019-05-30Add bit to bin.7June McEnroe 2019-05-30Simplify and build bitJune McEnroe 2019-05-29Add xx -p optionJune McEnroe 2019-05-27Add FrontierJune McEnroe 2019-05-27Break nicks with ZWNJJune McEnroe 2019-05-26Add DawnJune McEnroe 2019-05-20Declare vasprintf(3) for GNUJune McEnroe 2019-05-20Fix comparison warning in ttpreJune McEnroe 2019-05-20Add AuthorityJune McEnroe 2019-05-19Specify precedence of unary versions of operatorsJune McEnroe 2019-05-18Add compound assignment operators to orderJune McEnroe 2019-05-15Support simple assignment in orderJune McEnroe 2019-05-15Implement sizeof in orderJune McEnroe 2019-05-15Add orderJune McEnroe 2019-05-12Add T suffix in bitJune McEnroe 2019-05-10Highlight yacc and lex files as CJune McEnroe 2019-05-10Use val instead of suboptargJune McEnroe 2019-05-09Add Parable of the SowerJune McEnroe 2019-05-07Add bit without buildJune McEnroe 2019-05-04Fix MANDIR typoJune McEnroe 2019-05-04Move relay to binJune McEnroe