com php-src: check for NULL and avoid crashes: ext/soap/php_e ncoding.c
| From: | Antony Dovgal | Date: | Mon, 25 Jan 2016 11:29:51 +0000 |
| Subject: | com php-src: check for NULL and avoid crashes: ext/soap/php_e ncoding.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90752@lists.php.net to get a copy of this message | ||
Commit: 52d89557f316892b91c47155fdf7e72e76fd107c
Author: Antony Dovgal <tony2001@php.net> Mon, 25 Jan 2016 14:29:51 +0300
Parents: 63fb2b71187433f404261d30c6eb2b0c97408d4e
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=52d89557f316892b91c47155fdf7e72e76fd107c
Log:
check for NULL and avoid crashes
Changed paths:
M ext/soap/php_encoding.c
Diff:
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 5d9064a..1fdc5a8 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -3014,7 +3014,11 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style,
xmlNodeP
xmlFreeNode(dummy);
} ZEND_HASH_FOREACH_END();
smart_str_0(&list);
- xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(list.s)), ZSTR_LEN(list.s));
+ if (list.s) {
+ xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(list.s)), ZSTR_LEN(list.s));
+ } else {
+ xmlNodeSetContentLen(ret, BAD_CAST(""), 0);
+ }
smart_str_free(&list);
} else {
zval tmp;
@@ -3054,7 +3058,11 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style,
xmlNodeP
start = next;
}
smart_str_0(&list);
- xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(list.s)), ZSTR_LEN(list.s));
+ if (list.s) {
+ xmlNodeSetContentLen(ret, BAD_CAST(ZSTR_VAL(list.s)), ZSTR_LEN(list.s));
+ } else {
+ xmlNodeSetContentLen(ret, BAD_CAST(""), 0);
+ }
smart_str_free(&list);
efree(str);
if (data == &tmp) {zval_dtor(&tmp);}