Mail: stricter IMAP literals validation.

As clarified in RFC 3501, Section 7.5, literals are followed
either by SP, for additional command arguments, or CRLF.
This commit is contained in:
Sergey Kandaurov 2026-02-27 21:18:16 +04:00 committed by Sergey Kandaurov
parent 9e7f0f4c53
commit aa65a60fc7

View file

@ -598,20 +598,16 @@ ngx_mail_imap_parse_command(ngx_mail_session_t *s)
case sw_end_literal_argument:
switch (ch) {
case '{':
if (s->args.nelts <= 2) {
state = sw_literal;
break;
}
goto invalid;
case ' ':
state = sw_spaces_before_argument;
break;
case CR:
state = sw_almost_done;
break;
case LF:
goto done;
default:
state = sw_spaces_before_argument;
break;
goto invalid;
}
break;