View | Details | Raw Unified | Return to bug 72801
Collapse All | Expand All

(-)sylpheed-0.8.10claws.orig/src/codeconv.c (-6 / +8 lines)
Lines 1177-1183 const gchar *conv_get_current_locale(voi Link Here
1177
	return cur_locale;
1177
	return cur_locale;
1178
}
1178
}
1179
1179
1180
void conv_unmime_header_overwrite(gchar *str)
1180
void conv_unmime_header_overwrite(gchar *str, gint strsize)
1181
{
1181
{
1182
	gchar *buf;
1182
	gchar *buf;
1183
	gint buflen;
1183
	gint buflen;
Lines 1189-1200 void conv_unmime_header_overwrite(gchar Link Here
1189
		buflen = strlen(str) * 2 + 1;
1189
		buflen = strlen(str) * 2 + 1;
1190
		Xalloca(buf, buflen, return);
1190
		Xalloca(buf, buflen, return);
1191
		conv_anytodisp(buf, buflen, str);
1191
		conv_anytodisp(buf, buflen, str);
1192
		unmime_header(str, buf);
1192
		unmime_header(str, strsize, buf);
1193
	} else {
1193
	} else {
1194
		buflen = strlen(str) + 1;
1194
		buflen = strlen(str) + 1;
1195
		Xalloca(buf, buflen, return);
1195
		Xalloca(buf, buflen, return);
1196
		unmime_header(buf, str);
1196
		unmime_header(buf, buflen, str);
1197
		strncpy2(str, buf, buflen);
1197
		strncpy2(str, buf, strsize);
1198
	}
1198
	}
1199
}
1199
}
1200
1200
Lines 1203-1208 void conv_unmime_header(gchar *outbuf, g Link Here
1203
{
1203
{
1204
	CharSet cur_charset;
1204
	CharSet cur_charset;
1205
1205
1206
	g_return_if_fail(str != NULL);
1207
1206
	cur_charset = conv_get_current_charset();
1208
	cur_charset = conv_get_current_charset();
1207
1209
1208
	if (cur_charset == C_EUC_JP) {
1210
	if (cur_charset == C_EUC_JP) {
Lines 1212-1220 void conv_unmime_header(gchar *outbuf, g Link Here
1212
		buflen = strlen(str) * 2 + 1;
1214
		buflen = strlen(str) * 2 + 1;
1213
		Xalloca(buf, buflen, return);
1215
		Xalloca(buf, buflen, return);
1214
		conv_anytodisp(buf, buflen, str);
1216
		conv_anytodisp(buf, buflen, str);
1215
		unmime_header(outbuf, buf);
1217
		unmime_header(outbuf, outlen, buf);
1216
	} else
1218
	} else
1217
		unmime_header(outbuf, str);
1219
		unmime_header(outbuf, outlen, str);
1218
}
1220
}
1219
1221
1220
#define MAX_LINELEN	76
1222
#define MAX_LINELEN	76
(-)sylpheed-0.8.10claws.orig/src/codeconv.h (-1 / +1 lines)
Lines 159-165 const gchar *conv_get_outgoing_charset_s Link Here
159
159
160
const gchar *conv_get_current_locale		(void);
160
const gchar *conv_get_current_locale		(void);
161
161
162
void conv_unmime_header_overwrite	(gchar		*str);
162
void conv_unmime_header_overwrite	(gchar		*str, gint strsize);
163
void conv_unmime_header			(gchar		*outbuf,
163
void conv_unmime_header			(gchar		*outbuf,
164
					 gint		 outlen,
164
					 gint		 outlen,
165
					 const gchar	*str,
165
					 const gchar	*str,
(-)sylpheed-0.8.10claws.orig/src/compose.c (-5 / +5 lines)
Lines 1431-1442 static gint compose_parse_header(Compose Link Here
1431
	fclose(fp);
1431
	fclose(fp);
1432
1432
1433
	if (hentry[H_REPLY_TO].body != NULL) {
1433
	if (hentry[H_REPLY_TO].body != NULL) {
1434
		conv_unmime_header_overwrite(hentry[H_REPLY_TO].body);
1434
		conv_unmime_header_overwrite(hentry[H_REPLY_TO].body, strlen(hentry[H_REPLY_TO].body));
1435
		compose->replyto = hentry[H_REPLY_TO].body;
1435
		compose->replyto = hentry[H_REPLY_TO].body;
1436
		hentry[H_REPLY_TO].body = NULL;
1436
		hentry[H_REPLY_TO].body = NULL;
1437
	}
1437
	}
1438
	if (hentry[H_CC].body != NULL) {
1438
	if (hentry[H_CC].body != NULL) {
1439
		conv_unmime_header_overwrite(hentry[H_CC].body);
1439
		conv_unmime_header_overwrite(hentry[H_CC].body, strlen(hentry[H_CC].body));
1440
		compose->cc = hentry[H_CC].body;
1440
		compose->cc = hentry[H_CC].body;
1441
		hentry[H_CC].body = NULL;
1441
		hentry[H_CC].body = NULL;
1442
	}
1442
	}
Lines 1452-1470 static gint compose_parse_header(Compose Link Here
1452
	}
1452
	}
1453
	if (hentry[H_BCC].body != NULL) {
1453
	if (hentry[H_BCC].body != NULL) {
1454
		if (compose->mode == COMPOSE_REEDIT) {
1454
		if (compose->mode == COMPOSE_REEDIT) {
1455
			conv_unmime_header_overwrite(hentry[H_BCC].body);
1455
			conv_unmime_header_overwrite(hentry[H_BCC].body, strlen(hentry[H_BCC].body));
1456
			compose->bcc = hentry[H_BCC].body;
1456
			compose->bcc = hentry[H_BCC].body;
1457
		} else
1457
		} else
1458
			g_free(hentry[H_BCC].body);
1458
			g_free(hentry[H_BCC].body);
1459
		hentry[H_BCC].body = NULL;
1459
		hentry[H_BCC].body = NULL;
1460
	}
1460
	}
1461
	if (hentry[H_NEWSGROUPS].body != NULL) {
1461
	if (hentry[H_NEWSGROUPS].body != NULL) {
1462
		conv_unmime_header_overwrite(hentry[H_NEWSGROUPS].body);
1462
		conv_unmime_header_overwrite(hentry[H_NEWSGROUPS].body, strlen(hentry[H_NEWSGROUPS].body));
1463
		compose->newsgroups = hentry[H_NEWSGROUPS].body;
1463
		compose->newsgroups = hentry[H_NEWSGROUPS].body;
1464
		hentry[H_NEWSGROUPS].body = NULL;
1464
		hentry[H_NEWSGROUPS].body = NULL;
1465
	}
1465
	}
1466
	if (hentry[H_FOLLOWUP_TO].body != NULL) {
1466
	if (hentry[H_FOLLOWUP_TO].body != NULL) {
1467
		conv_unmime_header_overwrite(hentry[H_FOLLOWUP_TO].body);
1467
		conv_unmime_header_overwrite(hentry[H_FOLLOWUP_TO].body, strlen(hentry[H_FOLLOWUP_TO].body));
1468
		compose->followup_to = hentry[H_FOLLOWUP_TO].body;
1468
		compose->followup_to = hentry[H_FOLLOWUP_TO].body;
1469
		hentry[H_FOLLOWUP_TO].body = NULL;
1469
		hentry[H_FOLLOWUP_TO].body = NULL;
1470
	}
1470
	}
(-)sylpheed-0.8.10claws.orig/src/procmime.c (-10 / +5 lines)
Lines 375-386 void procmime_scan_content_type(MimeInfo Link Here
375
			if (!strcasecmp(attr, "charset"))
375
			if (!strcasecmp(attr, "charset"))
376
				mimeinfo->charset = g_strdup(value);
376
				mimeinfo->charset = g_strdup(value);
377
			else if (!strcasecmp(attr, "name")) {
377
			else if (!strcasecmp(attr, "name")) {
378
				gchar *tmp;
378
				gchar tmp[BUFFSIZE];
379
				size_t len;
380
379
381
				len = strlen(value) + 1;
380
				conv_unmime_header(tmp, sizeof(tmp), value, NULL);
382
				Xalloca(tmp, len, return);
383
				conv_unmime_header(tmp, len, value, NULL);
384
				g_free(mimeinfo->name);
381
				g_free(mimeinfo->name);
385
				/*pgp signatures should NOT have a name */
382
				/*pgp signatures should NOT have a name */
386
				if (mimeinfo->content_type 
383
				if (mimeinfo->content_type 
Lines 442-453 void procmime_scan_content_disposition(M Link Here
442
439
443
		if (*value) {
440
		if (*value) {
444
			if (!strcasecmp(attr, "filename")) {
441
			if (!strcasecmp(attr, "filename")) {
445
				gchar *tmp;
442
				gchar tmp[BUFFSIZE];
446
				size_t len;
447
443
448
				len = strlen(value) + 1;
444
				conv_unmime_header(tmp, sizeof(tmp), value,
449
				Xalloca(tmp, len, return);
445
						   NULL);
450
				conv_unmime_header(tmp, len, value, NULL);
451
				g_free(mimeinfo->filename);
446
				g_free(mimeinfo->filename);
452
				/*pgp signatures should NOT have a name */
447
				/*pgp signatures should NOT have a name */
453
				if (mimeinfo->content_type 
448
				if (mimeinfo->content_type 
(-)sylpheed-0.8.10claws.orig/src/textview.c (+1 lines)
Lines 706-711 static void textview_show_html(TextView Link Here
706
		        textview_write_line(textview, str, NULL);
706
		        textview_write_line(textview, str, NULL);
707
	        }
707
	        }
708
	}
708
	}
709
	textview_write_line(textview, "\n", NULL);
709
	
710
	
710
	html_parser_destroy(parser);
711
	html_parser_destroy(parser);
711
}
712
}
(-)sylpheed-0.8.10claws.orig/src/unmime.c (-5 / +33 lines)
Lines 28-40 Link Here
28
#include "codeconv.h"
28
#include "codeconv.h"
29
#include "base64.h"
29
#include "base64.h"
30
#include "quoted-printable.h"
30
#include "quoted-printable.h"
31
#include "utils.h"
31
32
32
#define ENCODED_WORD_BEGIN	"=?"
33
#define ENCODED_WORD_BEGIN	"=?"
33
#define ENCODED_WORD_END	"?="
34
#define ENCODED_WORD_END	"?="
34
35
35
/* Decodes headers based on RFC2045 and RFC2047. */
36
/* Decodes headers based on RFC2045 and RFC2047. */
36
37
37
void unmime_header(gchar *out, const gchar *str)
38
void unmime_header(gchar *out, gint outlen, const gchar *str)
38
{
39
{
39
	const gchar *p = str;
40
	const gchar *p = str;
40
	gchar *outp = out;
41
	gchar *outp = out;
Lines 51-85 void unmime_header(gchar *out, const gch Link Here
51
52
52
		eword_begin_p = strstr(p, ENCODED_WORD_BEGIN);
53
		eword_begin_p = strstr(p, ENCODED_WORD_BEGIN);
53
		if (!eword_begin_p) {
54
		if (!eword_begin_p) {
54
			strcpy(outp, p);
55
			strncpy2(outp, p, outlen);
55
			return;
56
			return;
56
		}
57
		}
57
		encoding_begin_p = strchr(eword_begin_p + 2, '?');
58
		encoding_begin_p = strchr(eword_begin_p + 2, '?');
58
		if (!encoding_begin_p) {
59
		if (!encoding_begin_p) {
59
			strcpy(outp, p);
60
			strncpy2(outp, p, outlen);
60
			return;
61
			return;
61
		}
62
		}
62
		text_begin_p = strchr(encoding_begin_p + 1, '?');
63
		text_begin_p = strchr(encoding_begin_p + 1, '?');
63
		if (!text_begin_p) {
64
		if (!text_begin_p) {
64
			strcpy(outp, p);
65
			strncpy2(outp, p, outlen);
65
			return;
66
			return;
66
		}
67
		}
67
		eword_end_p = strstr(text_begin_p + 1, ENCODED_WORD_END);
68
		eword_end_p = strstr(text_begin_p + 1, ENCODED_WORD_END);
68
		if (!eword_end_p) {
69
		if (!eword_end_p) {
69
			strcpy(outp, p);
70
			strncpy2(outp, p, outlen);
70
			return;
71
			return;
71
		}
72
		}
72
73
73
		if (p == str) {
74
		if (p == str) {
75
			if (eword_begin_p - p > outlen - 1) {
76
				strncpy2(outp, p, outlen);
77
				return;
78
			}
74
			memcpy(outp, p, eword_begin_p - p);
79
			memcpy(outp, p, eword_begin_p - p);
75
			outp += eword_begin_p - p;
80
			outp += eword_begin_p - p;
81
			outlen -= eword_begin_p - p;
76
			p = eword_begin_p;
82
			p = eword_begin_p;
77
		} else {
83
		} else {
78
			/* ignore spaces between encoded words */
84
			/* ignore spaces between encoded words */
79
			for (sp = p; sp < eword_begin_p; sp++) {
85
			for (sp = p; sp < eword_begin_p; sp++) {
80
				if (!isspace(*sp)) {
86
				if (!isspace(*sp)) {
87
					if (eword_begin_p - p > outlen - 1) {
88
						strncpy2(outp, p, outlen);
89
						return;
90
					}
81
					memcpy(outp, p, eword_begin_p - p);
91
					memcpy(outp, p, eword_begin_p - p);
82
					outp += eword_begin_p - p;
92
					outp += eword_begin_p - p;
93
					outlen -= eword_begin_p - p;
83
					p = eword_begin_p;
94
					p = eword_begin_p;
84
					break;
95
					break;
85
				}
96
				}
Lines 105-112 void unmime_header(gchar *out, const gch Link Here
105
				(decoded_text, text_begin_p + 1,
116
				(decoded_text, text_begin_p + 1,
106
				 eword_end_p - (text_begin_p + 1));
117
				 eword_end_p - (text_begin_p + 1));
107
		} else {
118
		} else {
119
			if (eword_end_p + 2 - p > outlen - 1) {
120
				strncpy2(outp, p, outlen);
121
				return;
122
			}
108
			memcpy(outp, p, eword_end_p + 2 - p);
123
			memcpy(outp, p, eword_end_p + 2 - p);
109
			outp += eword_end_p + 2 - p;
124
			outp += eword_end_p + 2 - p;
125
			outlen -= eword_end_p + 2 - p;
110
			p = eword_end_p + 2;
126
			p = eword_end_p + 2;
111
			continue;
127
			continue;
112
		}
128
		}
Lines 115-127 void unmime_header(gchar *out, const gch Link Here
115
		conv_str = conv_codeset_strdup(decoded_text, charset, NULL);
131
		conv_str = conv_codeset_strdup(decoded_text, charset, NULL);
116
		if (conv_str) {
132
		if (conv_str) {
117
			len = strlen(conv_str);
133
			len = strlen(conv_str);
134
			if (len > outlen - 1) {
135
				strncpy2(outp, conv_str, outlen);
136
				g_free(conv_str);
137
				g_free(decoded_text);
138
				return;
139
			}
118
			memcpy(outp, conv_str, len);
140
			memcpy(outp, conv_str, len);
119
			g_free(conv_str);
141
			g_free(conv_str);
120
		} else {
142
		} else {
121
			len = strlen(decoded_text);
143
			len = strlen(decoded_text);
144
			if (len > outlen - 1) {
145
				conv_localetodisp(outp, outlen, decoded_text);
146
				g_free(decoded_text);
147
				return;
148
			}
122
			conv_localetodisp(outp, len + 1, decoded_text);
149
			conv_localetodisp(outp, len + 1, decoded_text);
123
		}
150
		}
124
		outp += len;
151
		outp += len;
152
		outlen -= len;
125
153
126
		g_free(decoded_text);
154
		g_free(decoded_text);
127
155
(-)sylpheed-0.8.10claws.orig/src/unmime.h (+1 lines)
Lines 23-28 Link Here
23
#include <glib.h>
23
#include <glib.h>
24
24
25
void unmime_header			(gchar		*out,
25
void unmime_header			(gchar		*out,
26
					 gint		 len,
26
					 const gchar	*str);
27
					 const gchar	*str);
27
gint unmime_quoted_printable_line	(gchar		*str);
28
gint unmime_quoted_printable_line	(gchar		*str);
28
29

Return to bug 72801