Skip to content

Commit 61ba79d

Browse files
committed
Remove variable registration code from rfc1867
This now longer does anything -- registering a variable for a NULL array is a no-op.
1 parent 4d78598 commit 61ba79d

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

main/rfc1867.c

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
678678
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0;
679679
size_t array_len = 0;
680680
int64_t total_bytes = 0, max_file_size = 0;
681-
int skip_upload = 0, anonymous_index = 0, is_anonymous;
681+
int skip_upload = 0, anonymous_index = 0;
682682
HashTable *uploaded_files = NULL;
683683
multipart_buffer *mbuff;
684684
zval *array_ptr = (zval *) arg;
@@ -921,11 +921,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
921921
}
922922

923923
if (!param) {
924-
is_anonymous = 1;
925924
param = emalloc(MAX_SIZE_ANONNAME);
926925
snprintf(param, MAX_SIZE_ANONNAME, "%u", anonymous_index++);
927-
} else {
928-
is_anonymous = 0;
929926
}
930927

931928
/* New Rule: never repair potential malicious user input */
@@ -1138,10 +1135,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
11381135
s = filename;
11391136
}
11401137

1141-
if (!is_anonymous) {
1142-
safe_php_register_variable(lbuf, s, strlen(s), NULL, 0);
1143-
}
1144-
11451138
/* Add $foo[name] */
11461139
if (is_arr_upload) {
11471140
snprintf(lbuf, llen, "%s[name][%s]", abuf, array_index);
@@ -1163,16 +1156,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
11631156
}
11641157
}
11651158

1166-
/* Add $foo_type */
1167-
if (is_arr_upload) {
1168-
snprintf(lbuf, llen, "%s_type[%s]", abuf, array_index);
1169-
} else {
1170-
snprintf(lbuf, llen, "%s_type", param);
1171-
}
1172-
if (!is_anonymous) {
1173-
safe_php_register_variable(lbuf, cd, strlen(cd), NULL, 0);
1174-
}
1175-
11761159
/* Add $foo[type] */
11771160
if (is_arr_upload) {
11781161
snprintf(lbuf, llen, "%s[type][%s]", abuf, array_index);
@@ -1195,16 +1178,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
11951178
/* Initialize variables */
11961179
add_protected_variable(param);
11971180

1198-
/* if param is of form xxx[.*] this will cut it to xxx */
1199-
if (!is_anonymous) {
1200-
if (temp_filename) {
1201-
ZVAL_STR_COPY(&zfilename, temp_filename);
1202-
} else {
1203-
ZVAL_EMPTY_STRING(&zfilename);
1204-
}
1205-
safe_php_register_variable_ex(param, &zfilename, NULL, 1);
1206-
}
1207-
12081181
/* Add $foo[tmp_name] */
12091182
if (is_arr_upload) {
12101183
snprintf(lbuf, llen, "%s[tmp_name][%s]", abuf, array_index);
@@ -1257,19 +1230,6 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
12571230
}
12581231
register_http_post_files_variable_ex(lbuf, &error_type, &PG(http_globals)[TRACK_VARS_FILES], 0);
12591232

1260-
/* Add $foo_size */
1261-
if (is_arr_upload) {
1262-
snprintf(lbuf, llen, "%s_size[%s]", abuf, array_index);
1263-
} else {
1264-
snprintf(lbuf, llen, "%s_size", param);
1265-
}
1266-
if (!is_anonymous) {
1267-
if (size_overflow) {
1268-
ZVAL_STRING(&file_size, file_size_buf);
1269-
}
1270-
safe_php_register_variable_ex(lbuf, &file_size, NULL, size_overflow);
1271-
}
1272-
12731233
/* Add $foo[size] */
12741234
if (is_arr_upload) {
12751235
snprintf(lbuf, llen, "%s[size][%s]", abuf, array_index);

0 commit comments

Comments
 (0)