Skip to content

Commit 43c9a21

Browse files
committed
Ignore empty Content-Transfer-Encoding headers
1 parent 133da40 commit 43c9a21

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ HYPERMAIL VERSION 2.4.0:
77
2019-12-19 Jose Kahan
88
* src/parse.c
99
parsemail(): a Content-Transfer-Encoding header with a missing value
10-
would output a random string when generating unsupported encoding
11-
body message.
10+
would result in an unitialized variable being used to output an unknown
11+
encoding warning message. Hypermail now skips this header if it's empty.
1212

1313
2019-11-22 Jose Kahan
1414
* src/print.c

src/parse.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,18 +2467,23 @@ int parsemail(char *mbox, /* file name */
24672467
char code[64];
24682468

24692469
/* is there any value for content-encoding or is it missing? */
2470-
if (*ptr) {
2471-
sscanf(ptr, "%63s", code);
2470+
if (sscanf(ptr, "%63s", code) != EOF) {
2471+
2472+
snprintf(line, sizeof(line_buf) - set_ietf_mbox,
2473+
" ('%s' %s)\n", code,
2474+
lang[MSG_ENCODING_IS_NOT_SUPPORTED]);
2475+
2476+
bp = addbody(bp, &lp, line,
2477+
BODY_HTMLIZED | bodyflags);
2478+
2479+
#if DEBUG_PARSE
2480+
printf("Ignoring unknown Content-Transfer-Encoding: %s\n", code);
2481+
#endif
24722482
} else {
2473-
code[0] = '\0';
2483+
#if DEBUG_PARSE
2484+
printf("Missing Content-Transfer-Encoding value\n");
2485+
#endif
24742486
}
2475-
2476-
snprintf(line, sizeof(line_buf) - set_ietf_mbox,
2477-
" ('%s' %s)\n", code,
2478-
lang[MSG_ENCODING_IS_NOT_SUPPORTED]);
2479-
2480-
bp = addbody(bp, &lp, line,
2481-
BODY_HTMLIZED | bodyflags);
24822487
}
24832488
#if DEBUG_PARSE
24842489
printf("DECODE set to %d\n", decode);

0 commit comments

Comments
 (0)