From: Michael Wallner Date: Thu, 22 Jan 2015 08:52:14 +0000 (+0100) Subject: ext/standard API updates X-Git-Tag: RELEASE_3_0_0_RC1~72 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=5ed9792021f1700c2b1e5682c43a0ccca9e97960;p=m6w6%2Fext-http ext/standard API updates --- diff --git a/php_http_message_body.c b/php_http_message_body.c index 2b7e308..f336f85 100644 --- a/php_http_message_body.c +++ b/php_http_message_body.c @@ -261,9 +261,9 @@ void php_http_message_body_add_part(php_http_message_body_t *body, php_http_mess ZEND_RESULT_CODE php_http_message_body_add_form_field(php_http_message_body_t *body, const char *name, const char *value_str, size_t value_len) { - zend_string *safe_name; + zend_string *safe_name = zend_string_init(name, strlen(name), 0); - safe_name = php_addslashes(estrdup(name), strlen(name), 1); + safe_name = php_addslashes(safe_name, 1); BOUNDARY_OPEN(body); php_http_message_body_appendf( @@ -283,9 +283,9 @@ ZEND_RESULT_CODE php_http_message_body_add_form_file(php_http_message_body_t *bo { size_t path_len = strlen(path); char *path_dup = estrndup(path, path_len); - zend_string *safe_name, *base_name; + zend_string *base_name, *safe_name = zend_string_init(name, strlen(name), 0); - safe_name = php_addslashes(estrdup(name), strlen(name), 1); + safe_name = php_addslashes(safe_name, 1); base_name = php_basename(path_dup, path_len, NULL, 0); BOUNDARY_OPEN(body); diff --git a/php_http_params.c b/php_http_params.c index 828eb93..7dbffb9 100644 --- a/php_http_params.c +++ b/php_http_params.c @@ -60,14 +60,14 @@ static inline void sanitize_escaped(zval *zv) ZVAL_STR(zv, php_http_cs2zs(deq, deq_len)); } - php_stripcslashes(Z_STRVAL_P(zv), &Z_STRLEN_P(zv)); + php_stripcslashes(Z_STR_P(zv)); } static inline void prepare_escaped(zval *zv) { if (Z_TYPE_P(zv) == IS_STRING) { size_t len = Z_STRLEN_P(zv); - zend_string *stripped = php_addcslashes(Z_STRVAL_P(zv), Z_STRLEN_P(zv), 0, + zend_string *stripped = php_addcslashes(Z_STR_P(zv), 0, ZEND_STRL("\0..\37\173\\\"")); if (len != stripped->len || strpbrk(stripped->val, "()<>@,;:\"[]?={} ")) {