]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: smtp-command-parser - Explicitly disallow 8-bit characters for AUTH response
authorStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 10 Dec 2024 14:45:12 +0000 (15:45 +0100)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 10 Dec 2024 15:12:24 +0000 (17:12 +0200)
Later Base64 parsing would catch that, but command parser errors become clearer
when this is caught early. Also, this fixes a unit test failure when
experimental SMTPUTF8 support is enabled.

When SMTPUTF8 support is disabled, smtp_char_is_textstr() disallows 8-bit
implicitly, but when SMTPUTF8 is enabled 8-bit octets will be let through.
This caused the invalidity unit test to fail.

src/lib-smtp/smtp-command-parser.c

index 63ae244d460a37ab315a54c0de74a753a8d2d794..abfdb4cc4bb9c1a4bf832400a7138ef076babcf1 100644 (file)
@@ -211,9 +211,11 @@ static int smtp_command_parse_parameters(struct smtp_command_parser *parser)
        while (p < parser->end) {
                unichar_t ch;
 
-               if (parser->auth_response)
+               if (parser->auth_response) {
+                       if ((*p & 0x80) != 0x00)
+                               break;
                        ch = *p;
-               else {
+               else {
                        nch = uni_utf8_get_char_n(p, (size_t)(parser->end - p),
                                                  &ch);
                }