Skip to content

Commit db1700c

Browse files
committed
5.4.0rc7
2 parents 9ad3aa6 + 29e2f05 commit db1700c

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3+
?? Feb 2012, PHP 5.4.0 RC 8
4+
35
02 Feb 2012, PHP 5.4.0 RC 7
46
- Core:
57
. Fix bug #60895 (Possible invalid handler usage in windows random

ext/mysqlnd/mysqlnd_wireprotocol.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,11 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
11771177
BAIL_IF_NO_MORE_DATA;
11781178
}
11791179

1180-
/* 1 byte filler */
1180+
/* 1 byte length */
1181+
if (12 != *p) {
1182+
DBG_ERR_FMT("Protocol error. Server sent false length. Expected 12 got %d", (int) *p);
1183+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Protocol error. Server sent false length. Expected 12");
1184+
}
11811185
p++;
11821186
BAIL_IF_NO_MORE_DATA;
11831187

main/php_variables.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
5757
{
5858
char *p = NULL;
5959
char *ip; /* index pointer */
60-
char *index, *escaped_index = NULL;
60+
char *index;
6161
char *var, *var_orig;
6262
int var_len, index_len;
6363
zval *gpc_element, **gpc_element_p;
@@ -174,26 +174,28 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
174174
if (!index) {
175175
MAKE_STD_ZVAL(gpc_element);
176176
array_init(gpc_element);
177-
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
177+
if (zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p) == FAILURE) {
178+
zval_ptr_dtor(&gpc_element);
179+
zval_dtor(val);
180+
free_alloca(var_orig, use_heap);
181+
return;
182+
}
178183
} else {
179-
escaped_index = index;
180-
if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE
184+
if (zend_symtable_find(symtable1, index, index_len + 1, (void **) &gpc_element_p) == FAILURE
181185
|| Z_TYPE_PP(gpc_element_p) != IS_ARRAY) {
182186
if (zend_hash_num_elements(symtable1) <= PG(max_input_vars)) {
183187
if (zend_hash_num_elements(symtable1) == PG(max_input_vars)) {
184188
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
185189
}
186190
MAKE_STD_ZVAL(gpc_element);
187191
array_init(gpc_element);
188-
zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
192+
zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
189193
} else {
194+
zval_dtor(val);
190195
free_alloca(var_orig, use_heap);
191196
return;
192197
}
193198
}
194-
if (index != escaped_index) {
195-
efree(escaped_index);
196-
}
197199
}
198200
symtable1 = Z_ARRVAL_PP(gpc_element_p);
199201
/* ip pointed to the '[' character, now obtain the key */
@@ -214,9 +216,10 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
214216
gpc_element->value = val->value;
215217
Z_TYPE_P(gpc_element) = Z_TYPE_P(val);
216218
if (!index) {
217-
zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
219+
if (zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p) == FAILURE) {
220+
zval_ptr_dtor(&gpc_element);
221+
}
218222
} else {
219-
escaped_index = index;
220223
/*
221224
* According to rfc2965, more specific paths are listed above the less specific ones.
222225
* If we encounter a duplicate cookie name, we should skip it, since it is not possible
@@ -225,21 +228,18 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
225228
*/
226229
if (PG(http_globals)[TRACK_VARS_COOKIE] &&
227230
symtable1 == Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) &&
228-
zend_symtable_exists(symtable1, escaped_index, index_len + 1)) {
231+
zend_symtable_exists(symtable1, index, index_len + 1)) {
229232
zval_ptr_dtor(&gpc_element);
230233
} else {
231234
if (zend_hash_num_elements(symtable1) <= PG(max_input_vars)) {
232235
if (zend_hash_num_elements(symtable1) == PG(max_input_vars)) {
233236
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
234237
}
235-
zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
238+
zend_symtable_update(symtable1, index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p);
236239
} else {
237240
zval_ptr_dtor(&gpc_element);
238241
}
239242
}
240-
if (escaped_index != index) {
241-
efree(escaped_index);
242-
}
243243
}
244244
}
245245
free_alloca(var_orig, use_heap);

0 commit comments

Comments
 (0)