When smtp_server_reply() detects that too many replies were sent regarding
syntax errors, it will terminate the connection. Most commands will just stop
processing and exit when a reply is submitted, so no crash occurs for those.
However, BDAT will try to skip the data block, so that it will not be
interpreted as a large set of input commands, which subsequentely crashes
because the command parser is already gone after terminating the connection.
}
}
- if (ret > 0 || size > 0) {
- /* read/skip data even in case of error, as long as size is
- known */
+ if (ret > 0 || (size > 0 && !conn->disconnected)) {
+ /* Read/skip data even in case of error, as long as size is
+ known and connection is still usable. */
input = smtp_command_parse_data_with_size(conn->smtp_parser,
size);
}