comparison src/accept.c @ 179:ec3fe72a3e99

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:52:17 +0200
parents 087e99c7702a
children
comparison
equal deleted inserted replaced
178:100a5d7e196a 179:ec3fe72a3e99
130 continue; 130 continue;
131 131
132 if (line1[0] == ' ' || line1[0] == '\t') { 132 if (line1[0] == ' ' || line1[0] == '\t') {
133 /* continuation of 'folded' header: */ 133 /* continuation of 'folded' header: */
134 if (hdr) { 134 if (hdr) {
135 hdr->header = g_strconcat(hdr->header, line1, NULL); 135 char* cp;
136 cp = g_strconcat(hdr->header, line1, NULL);
137 hdr->value = cp + (hdr->value - hdr->header);
138 free(hdr->header);
139 hdr->header = cp;
136 } 140 }
137 141
138 } else if (line1[0] == '\n') { 142 } else if (line1[0] == '\n') {
139 /* an empty line marks end of headers */ 143 /* an empty line marks end of headers */
140 in_headers = FALSE; 144 in_headers = FALSE;