masqmail
changeset 323:29de6a1c4538
Fixed an important bug with folded headers!
g_strconcat() returns a *copy* of the string, but hdr->value still
pointed to the old header (which probably was a memory leak, too).
If the folded part had been quite small it was likely that the new
string was at the same position as the old one, thus making everything
go well. But if pretty long headers were folded several times it was
likely that the new string was allocated somewhere else in memory,
thus breaking things. In result mails to lots of recipients (folded
header) were frequently only sent to the ones in the first line. Sorry
for the inconvenience.
author | meillo@marmaro.de |
---|---|
date | Fri, 03 Jun 2011 09:47:27 +0200 |
parents | 01d2f7a17bf0 |
children | a4d8f20a992f |
files | src/accept.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/src/accept.c Fri Jun 03 09:40:03 2011 +0200 1.2 +++ b/src/accept.c Fri Jun 03 09:47:27 2011 +0200 1.3 @@ -131,7 +131,11 @@ 1.4 if (line1[0] == ' ' || line1[0] == '\t') { 1.5 /* continuation of 'folded' header: */ 1.6 if (hdr) { 1.7 - hdr->header = g_strconcat(hdr->header, line1, NULL); 1.8 + char* cp; 1.9 + cp = g_strconcat(hdr->header, line1, NULL); 1.10 + hdr->value = cp + (hdr->value - hdr->header); 1.11 + free(hdr->header); 1.12 + hdr->header = cp; 1.13 } 1.14 1.15 } else if (line1[0] == '\n') {