summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-01-15 17:06:52 +0000
committerAntony Dovgal <tony2001@php.net>2007-01-15 17:06:52 +0000
commit902e6583d9f37885c886c768fd3dbce2079e512c (patch)
tree3411214069e7dbe1d8d666dd6a60c6714029b6a1 /main/streams/streams.c
parent3868c1533efce05a9dee1e0212d8913a59c4e972 (diff)
downloadphp-git-902e6583d9f37885c886c768fd3dbce2079e512c.tar.gz
add trailing '\0' to stream hashes
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index ddddd29f7f..cba7765734 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -1997,12 +1997,12 @@ PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *w
return FAILURE;
}
- return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len, &wrapper, sizeof(wrapper), NULL);
+ return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL);
}
PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
{
- return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol));
+ return zend_hash_del(&url_stream_wrappers_hash, protocol, strlen(protocol) + 1);
}
static void clone_wrapper_hash(TSRMLS_D)
@@ -2027,7 +2027,7 @@ PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, php_stream_w
clone_wrapper_hash(TSRMLS_C);
}
- return zend_hash_add(FG(stream_wrappers), protocol, protocol_len, &wrapper, sizeof(wrapper), NULL);
+ return zend_hash_add(FG(stream_wrappers), protocol, protocol_len + 1, &wrapper, sizeof(wrapper), NULL);
}
PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC)
@@ -2036,7 +2036,7 @@ PHPAPI int php_unregister_url_stream_wrapper_volatile(char *protocol TSRMLS_DC)
clone_wrapper_hash(TSRMLS_C);
}
- return zend_hash_del(FG(stream_wrappers), protocol, strlen(protocol));
+ return zend_hash_del(FG(stream_wrappers), protocol, strlen(protocol) + 1);
}
/* }}} */
@@ -2070,10 +2070,10 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char
}
if (protocol) {
- if (FAILURE == zend_hash_find(wrapper_hash, (char*)protocol, n, (void**)&wrapperpp)) {
- char *tmp = estrndup(protocol, n);
+ char *tmp = estrndup(protocol, n);
+ if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n + 1, (void**)&wrapperpp)) {
php_strtolower(tmp, n);
- if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n, (void**)&wrapperpp)) {
+ if (FAILURE == zend_hash_find(wrapper_hash, (char*)tmp, n + 1, (void**)&wrapperpp)) {
char wrapper_name[32];
if (n >= sizeof(wrapper_name)) {
@@ -2086,8 +2086,8 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char
wrapperpp = NULL;
protocol = NULL;
}
- efree(tmp);
}
+ efree(tmp);
}
/* TODO: curl based streams probably support file:// properly */
if (!protocol || !strncasecmp(protocol, "file", n)) {
@@ -2136,7 +2136,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, char
}
/* Check again, the original check might have not known the protocol name */
- if (zend_hash_find(wrapper_hash, "file", sizeof("file")-1, (void**)&wrapperpp) == SUCCESS) {
+ if (zend_hash_find(wrapper_hash, "file", sizeof("file"), (void**)&wrapperpp) == SUCCESS) {
return *wrapperpp;
}