Skip to content

Commit 133da40

Browse files
committed
Ignoring Content-Transfer-Encoding headers with missing values.
A Content-Transfer-Encoding header with a missing value would be handled the same as an unknown encoding value: a message would be included in the body of the converted message stating the encoding was unknown as well as the unknown encoding value. However, if the value was missing, hypermail would use the value of an unitialized variable.
1 parent dad66d7 commit 133da40

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Version Changes for Hypermail
44
HYPERMAIL VERSION 2.4.0:
55
============================
66

7+
2019-12-19 Jose Kahan
8+
* src/parse.c
9+
parsemail(): a Content-Transfer-Encoding header with a missing value
10+
would output a random string when generating unsupported encoding
11+
body message.
12+
713
2019-11-22 Jose Kahan
814
* src/print.c
915
printsubject() / printdates(): the "by suject" and "by dates" views

src/parse.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,7 +2466,13 @@ int parsemail(char *mbox, /* file name */
24662466
/* Unknown format, we use default decoding */
24672467
char code[64];
24682468

2469-
sscanf(ptr, "%63s", code);
2469+
/* is there any value for content-encoding or is it missing? */
2470+
if (*ptr) {
2471+
sscanf(ptr, "%63s", code);
2472+
} else {
2473+
code[0] = '\0';
2474+
}
2475+
24702476
snprintf(line, sizeof(line_buf) - set_ietf_mbox,
24712477
" ('%s' %s)\n", code,
24722478
lang[MSG_ENCODING_IS_NOT_SUPPORTED]);

0 commit comments

Comments
 (0)