Fixed possible SIGSEGV (Rob Richards)

This commit is contained in:
Dmitry Stogov 2005-12-09 15:29:15 +00:00
parent 4ccdc86561
commit eef44c609b
4 changed files with 20 additions and 16 deletions

View file

@ -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));
}
}
}

View file

@ -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);

View file

@ -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);
}
}
}
}

View file

@ -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;
}
/* }}} */