com php-src: Change string buffer handling in json scanner: ext/json/json_scanner.re
| From: | Jakub Zelenka | Date: | Wed, 03 Dec 2014 20:47:52 +0000 |
| Subject: | com php-src: Change string buffer handling in json scanner: ext/json/json_scanner.re | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84721@lists.php.net to get a copy of this message | ||
Commit: c51ea4799609ebd73521d1bbd69bd0d2bb47f328
Author: Jakub Zelenka <bukka@php.net> Wed, 3 Dec 2014 20:47:52 +0000
Parents: 098097d83f06d088b9f769c514d57b126c700833
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c51ea4799609ebd73521d1bbd69bd0d2bb47f328
Log:
Change string buffer handling in json scanner
Changed paths:
M ext/json/json_scanner.re
Diff:
diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re
index 99e63bb..79df124 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;