Skip to content

Commit 35ba0a6

Browse files
author
Peter McCluskey
committed
fix bug that sometimes caused a charset problem when Content-Type is us-ascii but message headers include other encoded text like utf-8
1 parent dc78f26 commit 35ba0a6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Version Changes for Hypermail
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Peter McCluskey (May 13, 2008)
4+
Change from Fumihiro Kato to fix bug that sometimes caused a charset
5+
problem when Content-Type is us-ascii but message headers
6+
include other encoded text like utf-8.
7+
38
Peter McCluskey (Nov 14, 2007)
49
Applied xhtml patch from Zvi Har'El.
510

src/parse.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ static char *mdecodeRFC2047(char *string, int length, char *charsetsave)
866866

867867
#ifdef HAVE_ICONV
868868
char *orig2,*output2,*output3;
869-
size_t len;
869+
size_t len, charsetlen;
870870
orig2=output2=malloc(strlen(string)+1);
871871
memset(output2,0,strlen(string)+1);
872872
old_output=output;
@@ -891,7 +891,9 @@ static char *mdecodeRFC2047(char *string, int length, char *charsetsave)
891891
memcpy(output,output3,len);
892892
output += len;
893893
free(output3);
894-
memcpy(charsetsave,charset,strlen(charset)<255 ? strlen(charset) : 255);
894+
charsetlen = strlen(charset) < 255 ? strlen(charset) : 255;
895+
memcpy(charsetsave,charset,charsetlen);
896+
charsetsave[charsetlen] = '\0';
895897
#else
896898
for (; *ptr; ptr++) {
897899
switch (*ptr) {

0 commit comments

Comments
 (0)