From d4df205018323af29b8fe8a04563e2ade02f56be Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Sun, 7 Sep 2008 14:17:24 +0000 Subject: [PATCH] More accurate max_file_size / upload_max_filesize (fixes #45124) --- main/rfc1867.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/rfc1867.c b/main/rfc1867.c index 25c5b8befe..d38f0574c1 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1335,12 +1335,12 @@ var_done: } - if (PG(upload_max_filesize) > 0 && total_bytes > PG(upload_max_filesize)) { + if (PG(upload_max_filesize) > 0 && (total_bytes+blen) > PG(upload_max_filesize)) { #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of %ld bytes exceeded - file [%r=%r] not saved", PG(upload_max_filesize), param, filename); #endif cancel_upload = UPLOAD_ERROR_A; - } else if (max_file_size && (total_bytes > max_file_size)) { + } else if (max_file_size && ((total_bytes+blen) > max_file_size)) { #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %ld bytes exceeded - file [%r=%r] not saved", max_file_size, param, filename); #endif @@ -1882,12 +1882,12 @@ static SAPI_POST_HANDLER_FUNC(rfc1867_post_handler_legacy) } - if (PG(upload_max_filesize) > 0 && total_bytes > PG(upload_max_filesize)) { + if (PG(upload_max_filesize) > 0 && (total_bytes+blen) > PG(upload_max_filesize)) { #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "upload_max_filesize of %ld bytes exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename); #endif cancel_upload = UPLOAD_ERROR_A; - } else if (max_file_size && (total_bytes > max_file_size)) { + } else if (max_file_size && ((total_bytes+blen) > max_file_size)) { #if DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %ld bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename); #endif -- 2.40.0