cvs: php3 /functions post.c
| From: | Sascha Schumann | Date: | Tue, 03 Oct 2000 19:41:10 +0000 |
| Subject: | cvs: php3 /functions post.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1928@lists.php.net to get a copy of this message | ||
sas Tue Oct 3 12:41:10 2000 EDT
Modified files:
/php3/functions post.c
Log:
Skip quotes around boundary element of Content-Type header.
PR: #7004
Index: php3/functions/post.c
diff -u php3/functions/post.c:1.127 php3/functions/post.c:1.128
--- php3/functions/post.c:1.127 Wed Apr 12 12:52:43 2000
+++ php3/functions/post.c Tue Oct 3 12:41:10 2000
@@ -161,7 +161,23 @@
file_upload = 1;
mb = strchr(ctype, '=');
if (mb) {
- strncpy(boundary, mb + 1, sizeof(boundary));
+ size_t len;
+
+ mb++;
+
+ len = strlen(mb);
+ if (len >= sizeof(boundary)) {
+ php3_error(E_WARNING, "File Upload Error: Boundary length exceeds limit.");
+ return NULL;
+ }
+
+ if (mb[0] == '"' && mb[len-1] == '"') {
+ memcpy(boundary, mb + 1, len - 2);
+ boundary[len - 2] = '\0';
+ } else {
+ /* Copies the NUL byte */
+ memcpy(boundary, mb, len + 1);
+ }
} else {
php3_error(E_WARNING, "File Upload Error: No MIME boundary found");
php3_error(E_WARNING, "There should have been a \"boundary=something\" in the
Content-Type string");