Skip to content

Commit 9c25d30

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.
1 parent 5d2f0cb commit 9c25d30

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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)