X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_params.c;h=4e34ee3f1d5b08dce441d1159853d56be955c41a;hb=a458b9a25cf0ec9b4d8bde2b22e43c44d71427c8;hp=2cc9a0912ffee8d4eddfe012e8c3a54f68657f80;hpb=d3485e3b28336153dca690e872ffe1ddc60fedd2;p=m6w6%2Fext-http diff --git a/php_http_params.c b/php_http_params.c index 2cc9a09..4e34ee3 100644 --- a/php_http_params.c +++ b/php_http_params.c @@ -6,17 +6,14 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2010, Michael Wallner | + | Copyright (c) 2004-2011, Michael Wallner | +--------------------------------------------------------------------+ */ -/* $Id: http_api.c 300299 2010-06-09 06:23:16Z mike $ */ - #include "php_http.h" PHP_HTTP_API void php_http_params_parse_default_func(void *arg, const char *key, int keylen, const char *val, int vallen TSRMLS_DC) { - char *kdup; zval tmp, *entry; HashTable *ht = (HashTable *) arg; @@ -27,15 +24,13 @@ PHP_HTTP_API void php_http_params_parse_default_func(void *arg, const char *key, MAKE_STD_ZVAL(entry); array_init(entry); if (keylen) { - kdup = estrndup(key, keylen); - add_assoc_stringl_ex(entry, kdup, keylen + 1, (char *) val, vallen, 1); - efree(kdup); + add_assoc_stringl_ex(entry, key, keylen + 1, estrndup(val, vallen), vallen, 0); } else { - add_next_index_stringl(entry, (char *) val, vallen, 1); + add_next_index_stringl(entry, val, vallen, 1); } add_next_index_zval(&tmp, entry); } else { - add_next_index_stringl(&tmp, (char *) key, keylen, 1); + add_next_index_stringl(&tmp, key, keylen, 1); } } } @@ -132,6 +127,7 @@ PHP_HTTP_API STATUS php_http_params_parse(const char *param, int flags, php_http if (flags & PHP_HTTP_PARAMS_ALLOW_COMMA) { goto add; } + /* fallthrough */ default: if (!val) { val = c; @@ -146,6 +142,7 @@ PHP_HTTP_API STATUS php_http_params_parse(const char *param, int flags, php_http if (flags & PHP_HTTP_PARAMS_ALLOW_COMMA) { goto allow_comma; } + /* fallthrough */ case '\r': case '\n': case '\t':