Skip to content

Commit ef38ff6

Browse files
committed
MFH: More accurate max_file_size / upload_max_filesize (fixes #45124)
1 parent dd95638 commit ef38ff6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main/rfc1867.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1077,12 +1077,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
10771077
}
10781078

10791079

1080-
if (PG(upload_max_filesize) > 0 && total_bytes > PG(upload_max_filesize)) {
1080+
if (PG(upload_max_filesize) > 0 && (total_bytes+blen) > PG(upload_max_filesize)) {
10811081
#if DEBUG_FILE_UPLOAD
10821082
sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of %ld bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
10831083
#endif
10841084
cancel_upload = UPLOAD_ERROR_A;
1085-
} else if (max_file_size && (total_bytes > max_file_size)) {
1085+
} else if (max_file_size && ((total_bytes+blen) > max_file_size)) {
10861086
#if DEBUG_FILE_UPLOAD
10871087
sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
10881088
#endif

0 commit comments

Comments
 (0)