Skip to content

Commit 64595cc

Browse files
committed
MFH - avoid choking on 0 byte files
1 parent fb49473 commit 64595cc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main/rfc1867.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "rfc1867.h"
3434

3535

36+
#undef DEBUG_FILE_UPLOAD
37+
3638
#define SAFE_RETURN { \
3739
if (lbuf) efree(lbuf); \
3840
if (abuf) efree(abuf); \
@@ -752,19 +754,19 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
752754
}
753755
fclose(fp);
754756

757+
#ifdef DEBUG_FILE_UPLOAD
755758
if(strlen(filename) > 0 && total_bytes == 0) {
756759
sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename);
757760
cancel_upload = UPLOAD_ERROR_E;
758761
}
759-
760-
if (cancel_upload || total_bytes == 0) {
762+
#endif
761763

764+
if (cancel_upload) {
762765
if (temp_filename) {
763766
unlink(temp_filename);
764767
efree(temp_filename);
765768
}
766769
temp_filename="";
767-
768770
} else {
769771
zend_hash_add(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename) + 1, &temp_filename, sizeof(char *), NULL);
770772
}

0 commit comments

Comments
 (0)