diff options
author | Jakub Zelenka <bukka@php.net> | 2014-12-03 20:47:52 +0000 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2014-12-03 20:47:52 +0000 |
commit | c51ea4799609ebd73521d1bbd69bd0d2bb47f328 (patch) | |
tree | e495852f4b6c81038567e761f69cd34851c9bbee /ext/json/json_scanner.re | |
parent | 098097d83f06d088b9f769c514d57b126c700833 (diff) | |
download | php-git-c51ea4799609ebd73521d1bbd69bd0d2bb47f328.tar.gz |
Change string buffer handling in json scanner
Diffstat (limited to 'ext/json/json_scanner.re')
-rw-r--r-- | ext/json/json_scanner.re | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re index 99e63bbb41..79df12413c 100644 --- a/ext/json/json_scanner.re +++ b/ext/json/json_scanner.re @@ -234,16 +234,16 @@ std: return PHP_JSON_T_ERROR; } <STR_P1>["] { - char *str; + zend_string *str; size_t len = s->cursor - s->str_start - s->str_esc - 1; if (len == 0) { PHP_JSON_CONDITION_SET(JS); ZVAL_EMPTY_STRING(&s->value); return PHP_JSON_T_ESTRING; } - str = emalloc(len + 1); - str[len] = 0; - ZVAL_STRINGL(&s->value, str, len); + str = zend_string_alloc(len, 0); + str->val[len] = '\0'; + ZVAL_STR(&s->value, str); if (s->str_esc) { s->pstr = (php_json_ctype *) Z_STRVAL(s->value); s->cursor = s->str_start; |