]> granicus.if.org Git - php/commitdiff
Fixed bug #70940 Segfault in soep / type_to_string
authorRemi Collet <remi@php.net>
Thu, 19 Nov 2015 07:18:13 +0000 (08:18 +0100)
committerRemi Collet <remi@php.net>
Thu, 19 Nov 2015 07:18:13 +0000 (08:18 +0100)
ext/soap/soap.c

index 6da617a983f76f15237963746ed4d1b7874819e5..4c746aaf29dce3ef8e32cbb9056985120bd25c67 100644 (file)
@@ -4802,7 +4802,9 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
                                                enc = enc->details.sdl_type->encode;
                                        }
                                        if (enc) {
-                                               smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
+                                               if (spaces.s) {
+                                                       smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
+                                               }
                                                smart_str_appendc(buf, ' ');
                                                smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str));
                                                smart_str_appendl(buf, " _;\n", 4);
@@ -4815,7 +4817,9 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
                                        sdlAttributePtr attr;
 
                                        ZEND_HASH_FOREACH_PTR(type->attributes, attr) {
-                                               smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
+                                               if (spaces.s) {
+                                                       smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s));
+                                               }
                                                smart_str_appendc(buf, ' ');
                                                if (attr->encode && attr->encode->details.type_str) {
                                                        smart_str_appends(buf, attr->encode->details.type_str);