Bugfix.
* libmailutils/string/vasnprintf.c (mu_vasnprintf): Operate on a fresh copy of va_alist in each new iteration. * libproto/imap/folder.c: Likewise. * libproto/nntp/nntp_sendline.c: Likewise.
Showing
3 changed files
with
15 additions
and
3 deletions
... | @@ -46,7 +46,13 @@ mu_vasnprintf (char **pbuf, size_t *psize, const char *fmt, va_list ap) | ... | @@ -46,7 +46,13 @@ mu_vasnprintf (char **pbuf, size_t *psize, const char *fmt, va_list ap) |
46 | 46 | ||
47 | for (;;) | 47 | for (;;) |
48 | { | 48 | { |
49 | ssize_t n = vsnprintf (buf, buflen, fmt, ap); | 49 | ssize_t n; |
50 | va_list aq; | ||
51 | |||
52 | va_copy(aq, ap); | ||
53 | n = vsnprintf (buf, buflen, fmt, aq); | ||
54 | va_end(aq); | ||
55 | |||
50 | if (n < 0 || n >= buflen || !memchr (buf, '\0', n + 1)) | 56 | if (n < 0 || n >= buflen || !memchr (buf, '\0', n + 1)) |
51 | { | 57 | { |
52 | char *newbuf; | 58 | char *newbuf; | ... | ... |
... | @@ -2150,7 +2150,10 @@ imap_writeline (f_imap_t f_imap, const char *format, ...) | ... | @@ -2150,7 +2150,10 @@ imap_writeline (f_imap_t f_imap, const char *format, ...) |
2150 | va_start(ap, format); | 2150 | va_start(ap, format); |
2151 | do | 2151 | do |
2152 | { | 2152 | { |
2153 | len = vsnprintf (f_imap->buffer, f_imap->buflen, format, ap); | 2153 | va_list aq; |
2154 | va_copy(aq, ap); | ||
2155 | len = vsnprintf (f_imap->buffer, f_imap->buflen, format, aq); | ||
2156 | va_end(aq); | ||
2154 | if (len < 0 || len >= (int)f_imap->buflen | 2157 | if (len < 0 || len >= (int)f_imap->buflen |
2155 | || !memchr (f_imap->buffer, '\0', len + 1)) | 2158 | || !memchr (f_imap->buffer, '\0', len + 1)) |
2156 | { | 2159 | { | ... | ... |
... | @@ -88,7 +88,10 @@ mu_nntp_writeline (mu_nntp_t nntp, const char *format, ...) | ... | @@ -88,7 +88,10 @@ mu_nntp_writeline (mu_nntp_t nntp, const char *format, ...) |
88 | let's try to cope. */ | 88 | let's try to cope. */ |
89 | do | 89 | do |
90 | { | 90 | { |
91 | len = vsnprintf (nntp->io.buf, nntp->io.len - 1, format, ap); | 91 | va_list aq; |
92 | va_copy(aq, ap); | ||
93 | len = vsnprintf (nntp->io.buf, nntp->io.len - 1, format, aq); | ||
94 | va_end(aq); | ||
92 | if (len < 0 || len >= (int)nntp->io.len | 95 | if (len < 0 || len >= (int)nntp->io.len |
93 | || !memchr (nntp->io.buf, '\0', len + 1)) | 96 | || !memchr (nntp->io.buf, '\0', len + 1)) |
94 | { | 97 | { | ... | ... |
-
Please register or sign in to post a comment