summaryrefslogtreecommitdiff
path: root/main/rfc1867.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-02-15 22:51:18 +0000
committerZeev Suraski <zeev@php.net>2000-02-15 22:51:18 +0000
commit4a211a80fb5702c5524c0db6e67a04d1a4156dc1 (patch)
tree998b7beb62f7f718452de7b8613f551367239e82 /main/rfc1867.c
parentea459657d111f82f254ee6133608b79b126973cd (diff)
downloadphp-git-4a211a80fb5702c5524c0db6e67a04d1a4156dc1.tar.gz
@- Fixed RFC1867 file upload under Windows (Zeev)
Fixed a memory leak
Diffstat (limited to 'main/rfc1867.c')
-rw-r--r--main/rfc1867.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index e9c430c1e5..ef01e1e3f8 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -67,8 +67,9 @@ static void php_mime_split(char *buf, int cnt, char *boundary)
state = 1;
eolsize = 2;
- if(*(loc+len)==0x0a)
+ if(*(loc+len)==0x0a) {
eolsize = 1;
+ }
rem -= (loc - ptr) + len + eolsize;
ptr = loc + len + eolsize;
@@ -204,7 +205,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary)
php_error(E_WARNING, "File Upload Error - No Mime boundary found after start of file header");
SAFE_RETURN;
}
- fn = tempnam(PG(upload_tmp_dir), "php");
+ fn = tempnam(PG(upload_tmp_dir), "php");
if ((loc - ptr - 4) > PG(upload_max_filesize)) {
php_error(E_WARNING, "Max file size of %ld bytes exceeded - file [%s] not saved", PG(upload_max_filesize),namebuf);
bytes=0;
@@ -217,7 +218,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary)
bytes = 0;
SET_VAR_STRING(namebuf, estrdup("none"));
} else {
- fp = fopen(fn, "w");
+ fp = fopen(fn, "wb");
if (!fp) {
php_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn);
SAFE_RETURN;