If convert_string() has nonreversible characters, the allocated output
buffer would be overwritten (and not freed) in rfc2047_encode().
Thanks to Richard Russon for the bug report and initial patch, and to
TAKAHASHI Tamotsu for the analysis and revised fix suggestion.
int ret = 0;
char *buf;
size_t bufpos, buflen;
- char *u, *t0, *t1, *t;
+ char *u = NULL, *t0, *t1, *t;
char *s0, *s1;
size_t ulen, r, n, wlen;
encoder_t encoder;
{
ret = 1;
icode = 0;
- u = safe_malloc ((ulen = dlen) + 1);
+ safe_realloc (&u, (ulen = dlen) + 1);
memcpy (u, d, dlen);
u[ulen] = 0;
}