Skip to content

Commit 56abb31

Browse files
committed
Fix bug #70951: Segmentation fault on invalid WSDL cache
We mix in the endianness and the zend_long size to make sure cache files can't be used on incompatible architectures. Closes GH-18707.
1 parent 90a9fb5 commit 56abb31

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ PHP NEWS
186186
header is correct). (nielsdos)
187187
. Fix namespace handling of WSDL and XML schema in SOAP,
188188
fixing at least GH-16320 and bug #68576. (nielsdos)
189+
. Fixed bug #70951 (Segmentation fault on invalid WSDL cache). (nielsdos)
189190

190191
- Sockets:
191192
. Added IPPROTO_ICMP/IPPROTO_ICMPV6 to create raw socket for ICMP usage.

ext/soap/php_sdl.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
# define O_BINARY 0
3232
#endif
3333

34+
#ifdef WORDS_BIGENDIAN
35+
# define SOAP_BIG_ENDIAN 1
36+
#else
37+
# define SOAP_BIG_ENDIAN 0
38+
#endif
39+
3440
static void delete_fault(zval *zv);
3541
static void delete_fault_persistent(zval *zv);
3642
static void delete_binding(zval *zv);
@@ -3188,9 +3194,13 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
31883194
char *user = php_get_current_user();
31893195
size_t user_len = user ? strlen(user) + 1 : 0;
31903196

3197+
/* System architecture identification (see bug #70951) */
3198+
static const char ids[] = {SIZEOF_ZEND_LONG, SOAP_BIG_ENDIAN};
3199+
31913200
md5str[0] = '\0';
31923201
PHP_MD5Init(&md5_context);
31933202
PHP_MD5Update(&md5_context, (unsigned char*)uri, uri_len);
3203+
PHP_MD5Update(&md5_context, ids, sizeof(ids));
31943204
PHP_MD5Final(digest, &md5_context);
31953205
make_digest(md5str, digest);
31963206
key = emalloc(len+sizeof("/wsdl-")-1+user_len+2+sizeof(md5str));

0 commit comments

Comments
 (0)