From eef44c609bdc848c510d159e15561c9bd7ce42c0 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 9 Dec 2005 15:29:15 +0000 Subject: [PATCH] Fixed possible SIGSEGV (Rob Richards) --- ext/soap/php_encoding.c | 2 +- ext/soap/php_schema.c | 6 +++++- ext/soap/php_sdl.c | 8 ++++---- ext/soap/soap.c | 20 ++++++++++---------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 1162a417cb..559fd75c7b 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -268,7 +268,7 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) { enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype)); } else { - enc = get_encoder(SOAP_GLOBAL(sdl), NULL, Z_STRVAL_PP(zstype)); + enc = get_encoder_ex(SOAP_GLOBAL(sdl), Z_STRVAL_PP(zstype), Z_STRLEN_PP(zstype)); } } } diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c index 565a7fb46b..0e6fb57a5b 100644 --- a/ext/soap/php_schema.c +++ b/ext/soap/php_schema.c @@ -232,7 +232,11 @@ int load_schema(sdlCtx *ctx, xmlNodePtr schema TSRMLS_DC) location = get_attribute(trav->properties, "schemaLocation"); if (ns != NULL && tns != NULL && strcmp(ns->children->content,tns->children->content) == 0) { - soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'", location->children->content); + if (location) { + soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'", location->children->content); + } else { + soap_error0(E_ERROR, "Parsing Schema: can't import schema. Namespace must not match the enclosing schema 'targetNamespace'"); + } } if (location) { xmlChar *base = xmlNodeGetBase(trav->doc, trav); diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 34d34e199e..bf0853ea7a 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -410,10 +410,10 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml if (!h->ns && h->element->namens) { h->ns = estrdup(h->element->namens); } - } - if (h->element->name) { - efree(h->name); - h->name = estrdup(h->element->name); + if (h->element->name) { + efree(h->name); + h->name = estrdup(h->element->name); + } } } } diff --git a/ext/soap/soap.c b/ext/soap/soap.c index a339f46716..9edcc7e5e0 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1108,7 +1108,7 @@ PHP_FUNCTION(PHP_SOAP_SERVER_CLASS, map) #endif -/* {{{ proto object SoapServer::SoapServer ( mixed wsdl [, array options]) +/* {{{ proto object SoapServer::setPersistence ( int mode ) Sets persistence mode of SoapServer */ PHP_METHOD(SoapServer, setPersistence) { @@ -1805,8 +1805,8 @@ fail: /* }}} */ -/* {{{ proto SoapServer::fault - SoapServer::fault */ +/* {{{ proto SoapServer::fault ( staring code, string string [, string actor [, mixed details [, string name]]] ) + Issue SoapFault indicating an error */ PHP_METHOD(SoapServer, fault) { char *code, *string, *actor=NULL, *name=NULL; @@ -2781,25 +2781,25 @@ PHP_METHOD(SoapClient, __setSoapHeaders) RETURN_NULL(); } - if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) { + if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) { zend_hash_del(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")); - } else if (Z_TYPE_P(headers) == IS_ARRAY || Z_TYPE_P(headers) == IS_OBJECT) { + } else if (Z_TYPE_P(headers) == IS_ARRAY) { zval *default_headers; verify_soap_headers_array(Z_ARRVAL_P(headers) TSRMLS_CC); if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers"), (void **) &default_headers)==FAILURE) { add_property_zval(this_ptr, "__default_headers", headers); } - } else if (Z_TYPE_P(headers) == IS_OBJECT && - Z_OBJCE_P(headers) == soap_header_class_entry) { + } else if (Z_TYPE_P(headers) == IS_OBJECT && + Z_OBJCE_P(headers) == soap_header_class_entry) { zval *default_headers; ALLOC_INIT_ZVAL(default_headers); array_init(default_headers); add_next_index_zval(default_headers, headers); add_property_zval(this_ptr, "__default_headers", default_headers); - } else{ - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid SOAP header"); - } + } else{ + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid SOAP header"); + } RETURN_TRUE; } /* }}} */ -- 2.40.0