Skip to content

Commit abf562c

Browse files
committed
Fix incorrect uri check in SOAP caching
If i == 0 then the check will compare 0 bytes. We are supposed to check if the uri is identical. Closes GH-12479.
1 parent 43e6316 commit abf562c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ PHP NEWS
2727
. Fixed bug #66150 (SOAP WSDL cache race condition causes Segmentation
2828
Fault). (nielsdos)
2929
. Fixed bug #67617 (SOAP leaves incomplete cache file on ENOSPC). (nielsdos)
30+
. Fix incorrect uri check in SOAP caching. (nielsdos)
3031

3132
- XSL:
3233
. Add missing module dependency. (nielsdos)

ext/soap/php_sdl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ static HashTable* sdl_deserialize_parameters(encodePtr *encoders, sdlTypePtr *ty
15371537
return ht;
15381538
}
15391539

1540-
static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t, time_t *cached)
1540+
static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, size_t uri_len, time_t t, time_t *cached)
15411541
{
15421542
sdlPtr sdl;
15431543
time_t old_t;
@@ -1584,7 +1584,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t, time
15841584
*cached = old_t;
15851585

15861586
WSDL_CACHE_GET_INT(i, &in);
1587-
if (i == 0 && strncmp(in, uri, i) != 0) {
1587+
if (i != uri_len || strncmp(in, uri, i) != 0) {
15881588
unlink(fn);
15891589
efree(buf);
15901590
return NULL;
@@ -3244,7 +3244,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
32443244
}
32453245
memcpy(key+len,md5str,sizeof(md5str));
32463246

3247-
if ((sdl = get_sdl_from_cache(key, uri, t-SOAP_GLOBAL(cache_ttl), &cached)) != NULL) {
3247+
if ((sdl = get_sdl_from_cache(key, uri, uri_len, t-SOAP_GLOBAL(cache_ttl), &cached)) != NULL) {
32483248
t = cached;
32493249
efree(key);
32503250
goto cache_in_memory;

0 commit comments

Comments
 (0)