ext/standard API updates
authorMichael Wallner <mike@php.net>
Thu, 22 Jan 2015 08:52:14 +0000 (09:52 +0100)
committerMichael Wallner <mike@php.net>
Thu, 22 Jan 2015 08:52:14 +0000 (09:52 +0100)
php_http_message_body.c
php_http_params.c

index 2b7e308adecb646085eea2ea8ede03cc6926345e..f336f85c2fa1676973dab191cc3d9a5990263a5b 100644 (file)
@@ -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);
index 828eb9371177edd80bb7e2a452cb7fb242e91351..7dbffb98d72b08584d19bd77c149861491d5923b 100644 (file)
@@ -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, "()<>@,;:\"[]?={} ")) {