summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2017-12-04 04:48:01 +0500
committerVladislav Grishenko <themiron@mail.ru>2017-12-30 22:49:40 +0500
commit5846bfc1b2f0154aed398661b30a42441954a841 (patch)
tree6de59b41ef6a334d032c58a421f2191d962e0f91
parent6f08b5ca4298a917ae8f41a93cb199e7b36720a8 (diff)
downloadaccel-ppp-5846bfc1b2f0154aed398661b30a42441954a841.tar.gz
accel-ppp-5846bfc1b2f0154aed398661b30a42441954a841.zip
sstp: fix va_start/va_end usage on x64 platforms
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 3e96193f..fa96a91e 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -309,21 +309,22 @@ static struct buffer_t *alloc_buf(size_t size)
static struct buffer_t *alloc_buf_printf(const char* format, ...)
{
- struct buffer_t *buf = NULL;
+ struct buffer_t *buf;
va_list ap;
int len;
va_start(ap, format);
len = vsnprintf(NULL, 0, format, ap);
- if (len < 0) {
- va_end(ap);
+ va_end(ap);
+ if (len < 0)
return NULL;
- }
buf = alloc_buf(len + 1);
- if (buf)
+ if (buf) {
+ va_start(ap, format);
vsnprintf(buf_put(buf, len), len + 1, format, ap);
- va_end(ap);
+ va_end(ap);
+ }
return buf;
}