From: Stephan Bosch Date: Fri, 29 Oct 2021 21:44:01 +0000 (+0200) Subject: lib-smtp: smtp-command - Use size_t for command line limits. X-Git-Tag: 2.3.18~168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d982aaadf17e503dd1f7019f151b7a840a01c181;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: smtp-command - Use size_t for command line limits. --- diff --git a/src/lib-smtp/smtp-command-parser.c b/src/lib-smtp/smtp-command-parser.c index b2e44c512f..575420a9a2 100644 --- a/src/lib-smtp/smtp-command-parser.c +++ b/src/lib-smtp/smtp-command-parser.c @@ -31,7 +31,7 @@ struct smtp_command_parser_state_data { char *cmd_name; char *cmd_params; - uoff_t poff; + size_t poff; }; struct smtp_command_parser { @@ -165,7 +165,7 @@ static int smtp_command_parse_identifier(struct smtp_command_parser *parser) static int smtp_command_parse_parameters(struct smtp_command_parser *parser) { const unsigned char *p, *mp; - uoff_t max_size = (parser->auth_response ? + size_t max_size = (parser->auth_response ? parser->limits.max_auth_size : parser->limits.max_parameters_size); int nch = 1; @@ -195,7 +195,7 @@ static int smtp_command_parse_parameters(struct smtp_command_parser *parser) break; p += nch; } - if (max_size > 0 && (uoff_t)(p - parser->cur) > max_size) { + if (max_size > 0 && (size_t)(p - parser->cur) > max_size) { smtp_command_parser_error( parser, SMTP_COMMAND_PARSE_ERROR_LINE_TOO_LONG, "%s line is too long", diff --git a/src/lib-smtp/smtp-command.h b/src/lib-smtp/smtp-command.h index 38605f194d..94f225169f 100644 --- a/src/lib-smtp/smtp-command.h +++ b/src/lib-smtp/smtp-command.h @@ -7,9 +7,9 @@ struct smtp_command_limits { /* Maximum size of command parameters, starting after first space */ - uoff_t max_parameters_size; + size_t max_parameters_size; /* Maximum size of authentication response */ - uoff_t max_auth_size; + size_t max_auth_size; /* Absolute maximum size of command data, beyond which the parser yields a fatal error; i.e. closing the connection in the server. This should be higher than a normal message size limit, which would return a