From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Patch from Christian Neukirchen <chneukirchen at gmail dot com>:
Date: Fri, 20 Mar 2015 10:25:42 -0500 (EST) [thread overview]
Message-ID: <16121298940978232821.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Patch from Christian Neukirchen <chneukirchen at gmail dot com>:
He reports that on some platforms, it is not possible to use the
same va_list twice. So use va_copy(3) for additional safety.
Modified Files:
--------------
mdocml:
compat_vasprintf.c
Revision Data
-------------
Index: compat_vasprintf.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/compat_vasprintf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lcompat_vasprintf.c -Lcompat_vasprintf.c -u -p -r1.1 -r1.2
--- compat_vasprintf.c
+++ compat_vasprintf.c
@@ -37,10 +37,14 @@ int
vasprintf(char **ret, const char *format, va_list ap)
{
char buf[2];
+ va_list ap2;
int sz;
- if ((sz = vsnprintf(buf, sizeof(buf), format, ap)) != -1 &&
- (*ret = malloc(sz + 1)) != NULL) {
+ va_copy(ap2, ap);
+ sz = vsnprintf(buf, sizeof(buf), format, ap2);
+ va_end(ap2);
+
+ if (sz != -1 && (*ret = malloc(sz + 1)) != NULL) {
if (vsnprintf(*ret, sz + 1, format, ap) == sz)
return(sz);
free(*ret);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2015-03-20 15:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16121298940978232821.enqueue@fantadrom.bsd.lv \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).