diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-30 15:00:32 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-30 15:00:32 -0800 |
commit | 834266acfdb2aa63e07ae03b08ae11ca21e00dcf (patch) | |
tree | 2318ffbb8e381a1cb2a04c347366207039421ff9 /src | |
parent | 1cea53dbc7b87434184c8a9a0901be5ea5a9c5a0 (diff) |
Revert "Remove unneeded va_copy"
This reverts commit 485ef21b95e257e9d9cbcaa804c3c164f1f49a80.
Apparently the va_copy IS needed, because without this code
we get segfaults in some cases.
Closes #253.
@nwellnhof, can you have a look at this issue and comment?
I understand that this code was removed for portability reasons.
Is there an alternative solution?
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index f273f45..b508310 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -166,10 +166,13 @@ int cmark_strbuf_vprintf(cmark_strbuf *buf, const char *format, va_list ap) ENSURE_SIZE(buf, expected_size); while (1) { + va_list args; + va_copy(args, ap); + len = vsnprintf( (char *)buf->ptr + buf->size, buf->asize - buf->size, - format, ap + format, args ); if (len < 0) { |