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

(-)sylpheed-0.9.2.orig/src/codeconv.c (-6 / +8 lines)
Lines 1450-1456 Link Here
1450
	return cur_locale;
1450
	return cur_locale;
1451
}
1451
}
1452
1452
1453
void conv_unmime_header_overwrite(gchar *str)
1453
void conv_unmime_header_overwrite(gchar *str, size_t strsize)
1454
{
1454
{
1455
	gchar *buf;
1455
	gchar *buf;
1456
	gint buflen;
1456
	gint buflen;
Lines 1464-1475 Link Here
1464
		buflen = strlen(str) * 2 + 1;
1464
		buflen = strlen(str) * 2 + 1;
1465
		Xalloca(buf, buflen, return);
1465
		Xalloca(buf, buflen, return);
1466
		conv_anytodisp(buf, buflen, str);
1466
		conv_anytodisp(buf, buflen, str);
1467
		unmime_header(str, buf);
1467
		unmime_header(str, buf, strsize);
1468
	} else {
1468
	} else {
1469
		buflen = strlen(str) + 1;
1469
		buflen = strlen(str) + 1;
1470
		Xalloca(buf, buflen, return);
1470
		Xalloca(buf, buflen, return);
1471
		unmime_header(buf, str);
1471
		unmime_header(buf, str, buflen);
1472
		strncpy2(str, buf, buflen);
1472
		strncpy2(str, buf, strsize);
1473
	}
1473
	}
1474
}
1474
}
1475
1475
Lines 1478-1483 Link Here
1478
{
1478
{
1479
	CharSet cur_charset;
1479
	CharSet cur_charset;
1480
1480
1481
	g_return_if_fail(str != NULL);
1482
1481
	cur_charset = conv_get_current_charset();
1483
	cur_charset = conv_get_current_charset();
1482
1484
1483
	if (cur_charset == C_EUC_JP) {
1485
	if (cur_charset == C_EUC_JP) {
Lines 1487-1495 Link Here
1487
		buflen = strlen(str) * 2 + 1;
1489
		buflen = strlen(str) * 2 + 1;
1488
		Xalloca(buf, buflen, return);
1490
		Xalloca(buf, buflen, return);
1489
		conv_anytodisp(buf, buflen, str);
1491
		conv_anytodisp(buf, buflen, str);
1490
		unmime_header(outbuf, buf);
1492
		unmime_header(outbuf, outlen, buf);
1491
	} else
1493
	} else
1492
		unmime_header(outbuf, str);
1494
		unmime_header(outbuf, outlen, str);
1493
}
1495
}
1494
1496
1495
#define MAX_LINELEN		76
1497
#define MAX_LINELEN		76
(-)sylpheed-0.9.2.orig/src/codeconv.h (-1 / +1 lines)
Lines 216-222 Link Here
216
216
217
const gchar *conv_get_current_locale		(void);
217
const gchar *conv_get_current_locale		(void);
218
218
219
void conv_unmime_header_overwrite	(gchar		*str);
219
void conv_unmime_header_overwrite	(gchar		*str, size_t strsize);
220
void conv_unmime_header			(gchar		*outbuf,
220
void conv_unmime_header			(gchar		*outbuf,
221
					 gint		 outlen,
221
					 gint		 outlen,
222
					 const gchar	*str,
222
					 const gchar	*str,
(-)sylpheed-0.9.2.orig/src/compose.c (-5 / +5 lines)
Lines 1595-1606 Link Here
1595
	fclose(fp);
1595
	fclose(fp);
1596
1596
1597
	if (hentry[H_REPLY_TO].body != NULL) {
1597
	if (hentry[H_REPLY_TO].body != NULL) {
1598
		conv_unmime_header_overwrite(hentry[H_REPLY_TO].body);
1598
		conv_unmime_header_overwrite(hentry[H_REPLY_TO].body, strlen(hentry[H_REPLY_TO].body));
1599
		compose->replyto = hentry[H_REPLY_TO].body;
1599
		compose->replyto = hentry[H_REPLY_TO].body;
1600
		hentry[H_REPLY_TO].body = NULL;
1600
		hentry[H_REPLY_TO].body = NULL;
1601
	}
1601
	}
1602
	if (hentry[H_CC].body != NULL) {
1602
	if (hentry[H_CC].body != NULL) {
1603
		conv_unmime_header_overwrite(hentry[H_CC].body);
1603
		conv_unmime_header_overwrite(hentry[H_CC].body, strlen(hentry[H_CC].body));
1604
		compose->cc = hentry[H_CC].body;
1604
		compose->cc = hentry[H_CC].body;
1605
		hentry[H_CC].body = NULL;
1605
		hentry[H_CC].body = NULL;
1606
	}
1606
	}
Lines 1616-1634 Link Here
1616
	}
1616
	}
1617
	if (hentry[H_BCC].body != NULL) {
1617
	if (hentry[H_BCC].body != NULL) {
1618
		if (compose->mode == COMPOSE_REEDIT) {
1618
		if (compose->mode == COMPOSE_REEDIT) {
1619
			conv_unmime_header_overwrite(hentry[H_BCC].body);
1619
			conv_unmime_header_overwrite(hentry[H_BCC].body, strlen(hentry[H_BCC].body));
1620
			compose->bcc = hentry[H_BCC].body;
1620
			compose->bcc = hentry[H_BCC].body;
1621
		} else
1621
		} else
1622
			g_free(hentry[H_BCC].body);
1622
			g_free(hentry[H_BCC].body);
1623
		hentry[H_BCC].body = NULL;
1623
		hentry[H_BCC].body = NULL;
1624
	}
1624
	}
1625
	if (hentry[H_NEWSGROUPS].body != NULL) {
1625
	if (hentry[H_NEWSGROUPS].body != NULL) {
1626
		conv_unmime_header_overwrite(hentry[H_NEWSGROUPS].body);
1626
		conv_unmime_header_overwrite(hentry[H_NEWSGROUPS].body, strlen(hentry[H_NEWSGROUPS].body));
1627
		compose->newsgroups = hentry[H_NEWSGROUPS].body;
1627
		compose->newsgroups = hentry[H_NEWSGROUPS].body;
1628
		hentry[H_NEWSGROUPS].body = NULL;
1628
		hentry[H_NEWSGROUPS].body = NULL;
1629
	}
1629
	}
1630
	if (hentry[H_FOLLOWUP_TO].body != NULL) {
1630
	if (hentry[H_FOLLOWUP_TO].body != NULL) {
1631
		conv_unmime_header_overwrite(hentry[H_FOLLOWUP_TO].body);
1631
		conv_unmime_header_overwrite(hentry[H_FOLLOWUP_TO].body, strlen(hentry[H_FOLLOWUP_TO].body));
1632
		compose->followup_to = hentry[H_FOLLOWUP_TO].body;
1632
		compose->followup_to = hentry[H_FOLLOWUP_TO].body;
1633
		hentry[H_FOLLOWUP_TO].body = NULL;
1633
		hentry[H_FOLLOWUP_TO].body = NULL;
1634
	}
1634
	}
(-)sylpheed-0.9.2.orig/src/procmime.c (-6 / +6 lines)
Lines 996-1006 Link Here
996
	fseek(fp, mimeinfo->offset, SEEK_SET);
996
	fseek(fp, mimeinfo->offset, SEEK_SET);
997
	procheader_get_header_fields(fp, hentry);
997
	procheader_get_header_fields(fp, hentry);
998
	if (hentry[0].body != NULL)
998
	if (hentry[0].body != NULL)
999
		conv_unmime_header_overwrite(hentry[0].body);
999
		conv_unmime_header_overwrite(hentry[0].body, strlen(hentry[0].body));
1000
	if (hentry[2].body != NULL)
1000
	if (hentry[2].body != NULL)
1001
		conv_unmime_header_overwrite(hentry[2].body);
1001
		conv_unmime_header_overwrite(hentry[2].body, strlen(hentry[2].body));
1002
	if (hentry[4].body != NULL)
1002
	if (hentry[4].body != NULL)
1003
		conv_unmime_header_overwrite(hentry[4].body);
1003
		conv_unmime_header_overwrite(hentry[4].body, strlen(hentry[4].body));
1004
	content_start = ftell(fp);
1004
	content_start = ftell(fp);
1005
	fclose(fp);
1005
	fclose(fp);
1006
1006
Lines 1086-1096 Link Here
1086
			}
1086
			}
1087
			procheader_get_header_fields(fp, hentry);
1087
			procheader_get_header_fields(fp, hentry);
1088
			if (hentry[0].body != NULL)
1088
			if (hentry[0].body != NULL)
1089
				conv_unmime_header_overwrite(hentry[0].body);
1089
				conv_unmime_header_overwrite(hentry[0].body, strlen(hentry[0].body));
1090
			if (hentry[2].body != NULL)
1090
			if (hentry[2].body != NULL)
1091
				conv_unmime_header_overwrite(hentry[2].body);
1091
				conv_unmime_header_overwrite(hentry[2].body, strlen(hentry[2].body));
1092
			if (hentry[4].body != NULL)
1092
			if (hentry[4].body != NULL)
1093
				conv_unmime_header_overwrite(hentry[4].body);
1093
				conv_unmime_header_overwrite(hentry[4].body, strlen(hentry[4].body));
1094
			lastoffset = ftell(fp);
1094
			lastoffset = ftell(fp);
1095
		}
1095
		}
1096
	}
1096
	}
(-)sylpheed-0.9.2.orig/src/account.c (-1 / +2 lines)
Lines 256-262 Link Here
256
{
256
{
257
	static HeaderEntry hentry[] = {{"From:",		  NULL, FALSE},
257
	static HeaderEntry hentry[] = {{"From:",		  NULL, FALSE},
258
				       {"X-Sylpheed-Account-Id:", NULL, FALSE},
258
				       {"X-Sylpheed-Account-Id:", NULL, FALSE},
259
				       {"AID:",			  NULL, FALSE}};
259
				       {"AID:",			  NULL, FALSE},
260
				       {NULL,			  NULL, FALSE}};
260
261
261
	enum
262
	enum
262
	{
263
	{
(-)sylpheed-0.9.2.orig/src/procmime.c (-10 / +6 lines)
Lines 398-409 Link Here
398
			if (!strcasecmp(attr, "charset"))
398
			if (!strcasecmp(attr, "charset"))
399
				mimeinfo->charset = g_strdup(value);
399
				mimeinfo->charset = g_strdup(value);
400
			else if (!strcasecmp(attr, "name")) {
400
			else if (!strcasecmp(attr, "name")) {
401
				gchar *tmp;
401
				gchar tmp[BUFFSIZE];
402
				size_t len;
403
402
404
				len = strlen(value) + 1;
403
				conv_unmime_header(tmp, sizeof(tmp), value,
405
				Xalloca(tmp, len, return);
404
						   NULL);
406
				conv_unmime_header(tmp, len, value, NULL);
407
				mimeinfo->name = g_strdup(tmp);
405
				mimeinfo->name = g_strdup(tmp);
408
			} else if (!strcasecmp(attr, "boundary"))
406
			} else if (!strcasecmp(attr, "boundary"))
409
				mimeinfo->boundary = g_strdup(value);
407
				mimeinfo->boundary = g_strdup(value);
Lines 461-472 Link Here
461
459
462
		if (*value) {
460
		if (*value) {
463
			if (!strcasecmp(attr, "filename")) {
461
			if (!strcasecmp(attr, "filename")) {
464
				gchar *tmp;
462
				gchar tmp[BUFFSIZE];
465
				size_t len;
466
463
467
				len = strlen(value) + 1;
464
				conv_unmime_header(tmp, sizeof(tmp), value,
468
				Xalloca(tmp, len, return);
465
						   NULL);
469
				conv_unmime_header(tmp, len, value, NULL);
470
				g_free(mimeinfo->filename);
466
				g_free(mimeinfo->filename);
471
				mimeinfo->filename = g_strdup(tmp);
467
				mimeinfo->filename = g_strdup(tmp);
472
				break;
468
				break;
(-)sylpheed-0.9.2.orig/src/smtp.c (-1 / +1 lines)
Lines 266-272 Link Here
266
		const gchar *p = msg;
266
		const gchar *p = msg;
267
		p += 3;
267
		p += 3;
268
		if (*p == '-' || *p == ' ') p++;
268
		if (*p == '-' || *p == ' ') p++;
269
		if (g_strncasecmp(p, "AUTH", 4) == 0) {
269
		if (g_strncasecmp(p, "AUTH", 4) == 0 && p[4] != '\0') {
270
			p += 5;
270
			p += 5;
271
			if (strcasestr(p, "LOGIN"))
271
			if (strcasestr(p, "LOGIN"))
272
				session->avail_auth_type |= SMTPAUTH_LOGIN;
272
				session->avail_auth_type |= SMTPAUTH_LOGIN;
(-)sylpheed-0.9.2.orig/src/textview.c (+2 lines)
Lines 678-683 Link Here
678
		else
678
		else
679
			textview_write_line(textview, str, NULL);
679
			textview_write_line(textview, str, NULL);
680
	}
680
	}
681
	textview_write_line(textview, "\n", NULL);
682
681
	html_parser_destroy(parser);
683
	html_parser_destroy(parser);
682
}
684
}
683
685
(-)sylpheed-0.9.2.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 50-77 Link Here
50
51
51
		eword_begin_p = strstr(p, ENCODED_WORD_BEGIN);
52
		eword_begin_p = strstr(p, ENCODED_WORD_BEGIN);
52
		if (!eword_begin_p) {
53
		if (!eword_begin_p) {
53
			strcpy(outp, p);
54
			strncpy2(outp, p, outlen);
54
			return;
55
			return;
55
		}
56
		}
56
		encoding_begin_p = strchr(eword_begin_p + 2, '?');
57
		encoding_begin_p = strchr(eword_begin_p + 2, '?');
57
		if (!encoding_begin_p) {
58
		if (!encoding_begin_p) {
58
			strcpy(outp, p);
59
			strncpy2(outp, p, outlen);
59
			return;
60
			return;
60
		}
61
		}
61
		text_begin_p = strchr(encoding_begin_p + 1, '?');
62
		text_begin_p = strchr(encoding_begin_p + 1, '?');
62
		if (!text_begin_p) {
63
		if (!text_begin_p) {
63
			strcpy(outp, p);
64
			strncpy2(outp, p, outlen);
64
			return;
65
			return;
65
		}
66
		}
66
		eword_end_p = strstr(text_begin_p + 1, ENCODED_WORD_END);
67
		eword_end_p = strstr(text_begin_p + 1, ENCODED_WORD_END);
67
		if (!eword_end_p) {
68
		if (!eword_end_p) {
68
			strcpy(outp, p);
69
			strncpy2(outp, p, outlen);
69
			return;
70
			return;
70
		}
71
		}
71
72
72
		if (p == str) {
73
		if (p == str) {
74
			if (eword_begin_p - p > outlen - 1) {
75
				strncpy2(outp, p, outlen);
76
				return;
77
			}
73
			memcpy(outp, p, eword_begin_p - p);
78
			memcpy(outp, p, eword_begin_p - p);
74
			outp += eword_begin_p - p;
79
			outp += eword_begin_p - p;
80
			outlen -= eword_begin_p - p;
75
			p = eword_begin_p;
81
			p = eword_begin_p;
76
		} else {
82
		} else {
77
			/* ignore spaces between encoded words */
83
			/* ignore spaces between encoded words */
Lines 79-86 Link Here
79
85
80
			for (sp = p; sp < eword_begin_p; sp++) {
86
			for (sp = p; sp < eword_begin_p; sp++) {
81
				if (!isspace(*(const guchar *)sp)) {
87
				if (!isspace(*(const guchar *)sp)) {
88
					if (eword_begin_p - p > outlen - 1) {
89
						strncpy2(outp, p, outlen);
90
						return;
91
					}
82
					memcpy(outp, p, eword_begin_p - p);
92
					memcpy(outp, p, eword_begin_p - p);
83
					outp += eword_begin_p - p;
93
					outp += eword_begin_p - p;
94
					outlen -= eword_begin_p - p;
84
					p = eword_begin_p;
95
					p = eword_begin_p;
85
					break;
96
					break;
86
				}
97
				}
Lines 106-113 Link Here
106
				(decoded_text, text_begin_p + 1,
117
				(decoded_text, text_begin_p + 1,
107
				 eword_end_p - (text_begin_p + 1));
118
				 eword_end_p - (text_begin_p + 1));
108
		} else {
119
		} else {
120
			if (eword_end_p + 2 - p > outlen - 1) {
121
				strncpy2(outp, p, outlen);
122
				return;
123
			}
109
			memcpy(outp, p, eword_end_p + 2 - p);
124
			memcpy(outp, p, eword_end_p + 2 - p);
110
			outp += eword_end_p + 2 - p;
125
			outp += eword_end_p + 2 - p;
126
			outlen -= eword_end_p + 2 - p;
111
			p = eword_end_p + 2;
127
			p = eword_end_p + 2;
112
			continue;
128
			continue;
113
		}
129
		}
Lines 116-128 Link Here
116
		conv_str = conv_codeset_strdup(decoded_text, charset, NULL);
132
		conv_str = conv_codeset_strdup(decoded_text, charset, NULL);
117
		if (conv_str) {
133
		if (conv_str) {
118
			len = strlen(conv_str);
134
			len = strlen(conv_str);
135
			if (len > outlen - 1) {
136
				strncpy2(outp, conv_str, outlen);
137
				g_free(conv_str);
138
				g_free(decoded_text);
139
				return;
140
			}
119
			memcpy(outp, conv_str, len);
141
			memcpy(outp, conv_str, len);
120
			g_free(conv_str);
142
			g_free(conv_str);
121
		} else {
143
		} else {
122
			len = strlen(decoded_text);
144
			len = strlen(decoded_text);
145
			if (len > outlen - 1) {
146
				conv_localetodisp(outp, outlen, decoded_text);
147
				g_free(decoded_text);
148
				return;
149
			}
123
			conv_localetodisp(outp, len + 1, decoded_text);
150
			conv_localetodisp(outp, len + 1, decoded_text);
124
		}
151
		}
125
		outp += len;
152
		outp += len;
153
		outlen -= len;
126
154
127
		g_free(decoded_text);
155
		g_free(decoded_text);
128
156
(-)sylpheed-0.9.2.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