summaryrefslogtreecommitdiff
path: root/ext/soap/php_encoding.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2016-01-25 14:29:51 +0300
committerAntony Dovgal <tony2001@php.net>2016-01-25 14:30:33 +0300
commitc140bbb5dbf76e051205d33911df12bd33b270ca (patch)
tree47fef1df8364a4942f7c360e50957957163b1aa1 /ext/soap/php_encoding.c
parente7f2c5bd6ab047aa8b106bd3376f183fbf117d4d (diff)
downloadphp-git-c140bbb5dbf76e051205d33911df12bd33b270ca.tar.gz
check for NULL and avoid crashes
Diffstat (limited to 'ext/soap/php_encoding.c')
-rw-r--r--ext/soap/php_encoding.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 5d9064af70..1fdc5a8788 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);}