Commit 4778f425 4778f425c53181ce5ba2d4f927bd1c15d1e6d134 by Sergey Poznyakoff

(rfc2047_encode): Bugfix.

1 parent 4defa8ec
...@@ -264,13 +264,16 @@ rfc2047_encode (const char *charset, const char *encoding, ...@@ -264,13 +264,16 @@ rfc2047_encode (const char *charset, const char *encoding,
264 *result = malloc (2 + strlen (charset) + 3 + strlen (text) * 3 + 3); 264 *result = malloc (2 + strlen (charset) + 3 + strlen (text) * 3 + 3);
265 if (*result) 265 if (*result)
266 { 266 {
267 sprintf (*result, "=?%s?%s?", charset, encoding); 267 char *p = *result;
268 size_t s;
269
270 p += sprintf (p, "=?%s?%s?", charset, encoding);
268 271
269 rc = stream_sequential_read (output_stream, 272 rc = stream_sequential_read (output_stream,
270 *result + strlen (*result), 273 p,
271 strlen (text) * 3, NULL); 274 strlen (text) * 3, &s);
272 275
273 strcat (*result, "?="); 276 strcpy (p + s, "?=");
274 } 277 }
275 else 278 else
276 rc = ENOMEM; 279 rc = ENOMEM;
......