masqmail-0.2

changeset 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 100a5d7e196a
children 4e96665808c3
files src/accept.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/src/accept.c	Fri Jul 23 10:47:08 2010 +0200
     1.2 +++ b/src/accept.c	Fri Jun 03 09:52:17 2011 +0200
     1.3 @@ -132,7 +132,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') {