diff options
| author | Dmitry Stogov <dmitry@php.net> | 2005-06-01 14:42:50 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2005-06-01 14:42:50 +0000 |
| commit | eca56e4b59fb8ccdac8ae846bd128331c0bc408c (patch) | |
| tree | 4839c8456f54ef66f3af58118634512d12e640b4 /ext/soap/php_sdl.c | |
| parent | 05affa4c864672beed1e3e9f1b1f68b0c0bf372c (diff) | |
| download | php-git-eca56e4b59fb8ccdac8ae846bd128331c0bc408c.tar.gz | |
Fixed bug #32941 (Sending structured SOAP fault kills a php)
Diffstat (limited to 'ext/soap/php_sdl.c')
| -rw-r--r-- | ext/soap/php_sdl.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index ca71ce7ced..25022c80ea 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -50,21 +50,10 @@ encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr node, const char *type) parse_namespace(type, &cptype, &ns); nsptr = xmlSearchNs(node->doc, node, ns); if (nsptr != NULL) { - int ns_len = strlen(nsptr->href); - int type_len = strlen(cptype); - int len = ns_len + type_len + 1; - char *nscat = emalloc(len + 1); - - memcpy(nscat, nsptr->href, ns_len); - nscat[ns_len] = ':'; - memcpy(nscat+ns_len+1, cptype, type_len); - nscat[len] = '\0'; - - enc = get_encoder_ex(sdl, nscat, len); + enc = get_encoder(sdl, nsptr->href, cptype); if (enc == NULL) { - enc = get_encoder_ex(sdl, type, type_len); + enc = get_encoder_ex(sdl, cptype, strlen(cptype)); } - efree(nscat); } else { enc = get_encoder_ex(sdl, type, strlen(type)); } @@ -128,8 +117,24 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type) nscat[len] = '\0'; enc = get_encoder_ex(sdl, nscat, len); - efree(nscat); + + if (enc == NULL && + ((ns_len == sizeof(SOAP_1_1_ENC_NAMESPACE)-1 && + memcmp(ns, SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE)-1) == 0) || + (ns_len == sizeof(SOAP_1_2_ENC_NAMESPACE)-1 && + memcmp(ns, SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE)-1) == 0))) { + ns_len = sizeof(XSD_NAMESPACE)-1; + len = ns_len + type_len + 1; + nscat = emalloc(len + 1); + memcpy(nscat, XSD_NAMESPACE, sizeof(XSD_NAMESPACE)-1); + nscat[ns_len] = ':'; + memcpy(nscat+ns_len+1, type, type_len); + nscat[len] = '\0'; + + enc = get_encoder_ex(sdl, nscat, len); + efree(nscat); + } return enc; } |
