Skip to content

Commit

Permalink
check for NULL and avoid crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
tony2001 committed Jan 25, 2016
1 parent e7f2c5b commit c140bbb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);}
Expand Down

0 comments on commit c140bbb

Please sign in to comment.