diff options
Diffstat (limited to 'ext/soap/php_sdl.c')
-rw-r--r-- | ext/soap/php_sdl.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 1875bec41d..82fbd3bb20 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -116,7 +116,9 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type) int len = ns_len + type_len + 1; nscat = emalloc(len + 1); - memcpy(nscat, ns, ns_len); + if (ns) { + memcpy(nscat, ns, ns_len); + } nscat[ns_len] = ':'; memcpy(nscat+ns_len+1, type, type_len); nscat[len] = '\0'; @@ -737,7 +739,9 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri) zend_hash_init(&ctx.portTypes, 0, NULL, NULL, 0); zend_hash_init(&ctx.services, 0, NULL, NULL, 0); - load_wsdl_ex(this_ptr, struri,&ctx, 0); + load_wsdl_ex(this_ptr, struri, &ctx, 0); + zend_try { + schema_pass2(&ctx); n = zend_hash_num_elements(&ctx.services); @@ -1164,6 +1168,12 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri) soap_error0(E_ERROR, "Parsing WSDL: Could not find any usable binding services in WSDL."); } + } zend_catch { + /* Avoid persistent memory leak. */ + zend_hash_destroy(&ctx.docs); + zend_bailout(); + } zend_end_try(); + zend_hash_destroy(&ctx.messages); zend_hash_destroy(&ctx.bindings); zend_hash_destroy(&ctx.portTypes); @@ -1176,15 +1186,15 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri) #define WSDL_CACHE_VERSION 0x10 #define WSDL_CACHE_GET(ret,type,buf) memcpy(&ret,*buf,sizeof(type)); *buf += sizeof(type); -#define WSDL_CACHE_GET_INT(ret,buf) ret = ((unsigned char)(*buf)[0])|((unsigned char)(*buf)[1]<<8)|((unsigned char)(*buf)[2]<<16)|((int)(*buf)[3]<<24); *buf += 4; +#define WSDL_CACHE_GET_INT(ret,buf) ret = ((unsigned char)(*buf)[0])|((unsigned char)(*buf)[1]<<8)|((unsigned char)(*buf)[2]<<16)|((unsigned)(*buf)[3]<<24); *buf += 4; #define WSDL_CACHE_GET_1(ret,type,buf) ret = (type)(**buf); (*buf)++; #define WSDL_CACHE_GET_N(ret,n,buf) memcpy(ret,*buf,n); *buf += n; #define WSDL_CACHE_SKIP(n,buf) *buf += n; -#define WSDL_CACHE_PUT_INT(val,buf) smart_str_appendc(buf,val & 0xff); \ - smart_str_appendc(buf,(val >> 8) & 0xff); \ - smart_str_appendc(buf,(val >> 16) & 0xff); \ - smart_str_appendc(buf,(val >> 24) & 0xff); +#define WSDL_CACHE_PUT_INT(val,buf) smart_str_appendc(buf,(char)(val & 0xff)); \ + smart_str_appendc(buf,(char)((val >> 8) & 0xff)); \ + smart_str_appendc(buf,(char)((val >> 16) & 0xff)); \ + smart_str_appendc(buf,(char)((val >> 24) & 0xff)); #define WSDL_CACHE_PUT_1(val,buf) smart_str_appendc(buf,val); #define WSDL_CACHE_PUT_N(val,n,buf) smart_str_appendl(buf,(char*)val,n); |