]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: imap_parser_read_next_atom() - Reject special character DEL 0x7F
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 21 Feb 2023 10:04:36 +0000 (10:04 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Tue, 21 Feb 2023 11:35:31 +0000 (11:35 +0000)
atom-specials includes CTL, which in turn contains \x00-\x1F and \x7F DEL

src/lib-imap/imap-parser.c
src/lib-imap/test-imap-parser.c

index 82de03e293aaefa9d2e5fedc552bc69f18c8658e..643f80ceebbb19eab8680cc57ea670ff6c5ce211 100644 (file)
@@ -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;
                }
        }
index 906e63ca783b4462e8a1985359fe7f9ac399919b..8a09422282b3f98d4e5a621afb826722b5390332 100644 (file)
@@ -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 },