From: Marco Bettini Date: Tue, 21 Feb 2023 10:04:36 +0000 (+0000) Subject: imap: imap_parser_read_next_atom() - Reject special character DEL 0x7F X-Git-Tag: 2.4.0~2962 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05320b62b74ecf9f32d7db896575a45e79b02ff3;p=thirdparty%2Fdovecot%2Fcore.git imap: imap_parser_read_next_atom() - Reject special character DEL 0x7F atom-specials includes CTL, which in turn contains \x00-\x1F and \x7F DEL --- diff --git a/src/lib-imap/imap-parser.c b/src/lib-imap/imap-parser.c index 82de03e293..643f80ceeb 100644 --- a/src/lib-imap/imap-parser.c +++ b/src/lib-imap/imap-parser.c @@ -1001,7 +1001,7 @@ imap_parser_read_next_atom(struct imap_parser *parser, bool parsing_tag, break; default: if ((unsigned char)data[i] < ' ' || - (unsigned char)data[i] >= 0x80) + (unsigned char)data[i] >= 0x7F) return -1; } } diff --git a/src/lib-imap/test-imap-parser.c b/src/lib-imap/test-imap-parser.c index 906e63ca78..8a09422282 100644 --- a/src/lib-imap/test-imap-parser.c +++ b/src/lib-imap/test-imap-parser.c @@ -100,8 +100,11 @@ static void test_imap_parser_read_tag_cmd(void) { "\n", NULL, -1, BOTH }, { "tag", NULL, 0, BOTH }, { "tag\t", NULL, -1, BOTH }, - { "tag\001", NULL, -1, BOTH }, + { "tag\x01", NULL, -1, BOTH }, + { "tag\x1f", NULL, -1, BOTH }, + { "tag\x7f", NULL, -1, BOTH }, { "tag\x80", NULL, -1, BOTH }, + { "tag\xff", NULL, -1, BOTH }, { "tag(", NULL, -1, BOTH }, { "tag)", NULL, -1, BOTH }, { "tag{", NULL, -1, BOTH },