At least events use signed intmax_t for storing the mail size, which
can cause such large numbers to wrap to negative numbers.
}
/* size-value ::= 1*20DIGIT */
- if (str_to_uoff(value, ¶ms->size) < 0) {
+ if (str_to_uoff(value, ¶ms->size) < 0 ||
+ params->size > INTMAX_MAX) {
pmparser->error = "Unsupported SIZE parameter value";
pmparser->error_code = SMTP_PARAM_PARSE_ERROR_NOT_SUPPORTED;
return -1;
end-marker = "LAST"
*/
argv = t_strsplit(params, " ");
- if (argv[0] == NULL || str_to_uoff(argv[0], &size) < 0) {
+ if (argv[0] == NULL || str_to_uoff(argv[0], &size) < 0 ||
+ size > INTMAX_MAX) {
smtp_server_reply(cmd,
501, "5.5.4", "Invalid chunk size parameter");
size = 0;