Fix off-by-one in file & field count

This commit is contained in:
asonix 2023-07-18 18:03:51 -05:00
parent d3b16438c9
commit fb46235530

View file

@ -409,13 +409,13 @@ fn count<T, E>(
match content { match content {
MultipartContent::File(_) => { MultipartContent::File(_) => {
file_count += 1; file_count += 1;
if file_count >= form.max_files { if file_count > form.max_files {
return Err(Error::FileCount); return Err(Error::FileCount);
} }
} }
_ => { _ => {
field_count += 1; field_count += 1;
if field_count >= form.max_fields { if field_count > form.max_fields {
return Err(Error::FieldCount); return Err(Error::FieldCount);
} }
} }