[php-src] master: Remove variable registration code from rfc1867
| From: | Nikita Popov | Date: | Tue, 27 Apr 2021 10:30:54 +0000 |
| Subject: | [php-src] master: Remove variable registration code from rfc1867 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-115871@lists.php.net to get a copy of this message | ||
Author: Nikita Popov (nikic)
Date: 2021-04-27T12:30:46+02:00
Commit: https://github.com/php/php-src/commit/61ba79df17867715b265de8b47238f96e62edf9c
Raw diff: https://github.com/php/php-src/commit/61ba79df17867715b265de8b47238f96e62edf9c.diff
Remove variable registration code from rfc1867
This now longer does anything -- registering a variable for a NULL
array is a no-op.
Changed paths:
M main/rfc1867.c
Diff:
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 980706128565..aeec50b8571c 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -678,7 +678,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0;
size_t array_len = 0;
int64_t total_bytes = 0, max_file_size = 0;
- int skip_upload = 0, anonymous_index = 0, is_anonymous;
+ int skip_upload = 0, anonymous_index = 0;
HashTable *uploaded_files = NULL;
multipart_buffer *mbuff;
zval *array_ptr = (zval *) arg;
@@ -921,11 +921,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
if (!param) {
- is_anonymous = 1;
param = emalloc(MAX_SIZE_ANONNAME);
snprintf(param, MAX_SIZE_ANONNAME, "%u", anonymous_index++);
- } else {
- is_anonymous = 0;
}
/* New Rule: never repair potential malicious user input */
@@ -1138,10 +1135,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
s = filename;
}
- if (!is_anonymous) {
- safe_php_register_variable(lbuf, s, strlen(s), NULL, 0);
- }
-
/* Add $foo[name] */
if (is_arr_upload) {
snprintf(lbuf, llen, "%s[name][%s]", abuf, array_index);
@@ -1163,16 +1156,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
}
- /* Add $foo_type */
- if (is_arr_upload) {
- snprintf(lbuf, llen, "%s_type[%s]", abuf, array_index);
- } else {
- snprintf(lbuf, llen, "%s_type", param);
- }
- if (!is_anonymous) {
- safe_php_register_variable(lbuf, cd, strlen(cd), NULL, 0);
- }
-
/* Add $foo[type] */
if (is_arr_upload) {
snprintf(lbuf, llen, "%s[type][%s]", abuf, array_index);
@@ -1195,16 +1178,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
/* Initialize variables */
add_protected_variable(param);
- /* if param is of form xxx[.*] this will cut it to xxx */
- if (!is_anonymous) {
- if (temp_filename) {
- ZVAL_STR_COPY(&zfilename, temp_filename);
- } else {
- ZVAL_EMPTY_STRING(&zfilename);
- }
- safe_php_register_variable_ex(param, &zfilename, NULL, 1);
- }
-
/* Add $foo[tmp_name] */
if (is_arr_upload) {
snprintf(lbuf, llen, "%s[tmp_name][%s]", abuf, array_index);
@@ -1257,19 +1230,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
register_http_post_files_variable_ex(lbuf, &error_type,
&PG(http_globals)[TRACK_VARS_FILES], 0);
- /* Add $foo_size */
- if (is_arr_upload) {
- snprintf(lbuf, llen, "%s_size[%s]", abuf, array_index);
- } else {
- snprintf(lbuf, llen, "%s_size", param);
- }
- if (!is_anonymous) {
- if (size_overflow) {
- ZVAL_STRING(&file_size, file_size_buf);
- }
- safe_php_register_variable_ex(lbuf, &file_size, NULL, size_overflow);
- }
-
/* Add $foo[size] */
if (is_arr_upload) {
snprintf(lbuf, llen, "%s[size][%s]", abuf, array_index);