{
php_stream *stream;
php_stream_temp_data *ts;
- char *comma, *semi, *sep, *key;
+ char *comma, *semi, *sep;
size_t mlen, dlen, plen, vlen, ilen;
zend_off_t newoffs;
zval meta;
/* found parameter ... the heart of cs ppl lies in +1/-1 or was it +2 this time? */
plen = sep - path;
vlen = (semi ? (size_t)(semi - sep) : (mlen - plen)) - 1 /* '=' */;
- key = estrndup(path, plen);
- if (plen != sizeof("mediatype")-1 || memcmp(key, "mediatype", sizeof("mediatype")-1)) {
- add_assoc_stringl_ex(&meta, key, plen, sep + 1, vlen);
+ if (plen != sizeof("mediatype")-1 || memcmp(path, "mediatype", sizeof("mediatype")-1)) {
+ add_assoc_stringl_ex(&meta, path, plen, sep + 1, vlen);
}
- efree(key);
plen += vlen + 1;
mlen -= plen;
path += plen;
}
if (protocol) {
- char *tmp = estrndup(protocol, n);
- if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, (char*)tmp, n))) {
+ if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, protocol, n))) {
+ char *tmp = estrndup(protocol, n);
+
php_strtolower(tmp, n);
- if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, (char*)tmp, n))) {
+ if (NULL == (wrapper = zend_hash_str_find_ptr(wrapper_hash, tmp, n))) {
char wrapper_name[32];
if (n >= sizeof(wrapper_name)) {
wrapper = NULL;
protocol = NULL;
}
+ efree(tmp);
}
- efree(tmp);
}
/* TODO: curl based streams probably support file:// properly */
if (!protocol || !strncasecmp(protocol, "file", n)) {
PG(in_user_include)) && !PG(allow_url_include)))) {
if (options & REPORT_ERRORS) {
/* protocol[n] probably isn't '\0' */
- char *protocol_dup = estrndup(protocol, n);
if (!PG(allow_url_fopen)) {
- php_error_docref(NULL, E_WARNING, "%s:// wrapper is disabled in the server configuration by allow_url_fopen=0", protocol_dup);
+ php_error_docref(NULL, E_WARNING, "%.*s:// wrapper is disabled in the server configuration by allow_url_fopen=0", (int)n, protocol);
} else {
- php_error_docref(NULL, E_WARNING, "%s:// wrapper is disabled in the server configuration by allow_url_include=0", protocol_dup);
+ php_error_docref(NULL, E_WARNING, "%.*s:// wrapper is disabled in the server configuration by allow_url_include=0", (int)n, protocol);
}
- efree(protocol_dup);
}
return NULL;
}
}
if (protocol) {
- char *tmp = estrndup(protocol, n);
- if (NULL == (factory = zend_hash_str_find_ptr(&xport_hash, tmp, n))) {
+ if (NULL == (factory = zend_hash_str_find_ptr(&xport_hash, protocol, n))) {
char wrapper_name[32];
if (n >= sizeof(wrapper_name))
ERR_REPORT(error_string, "Unable to find the socket transport \"%s\" - did you forget to enable it when you configured PHP?",
wrapper_name);
- efree(tmp);
return NULL;
}
- efree(tmp);
}
if (factory == NULL) {