From: Stefan Esser Date: Fri, 28 May 2004 13:38:06 +0000 (+0000) Subject: Fixed off-by-one in http_fopen_wrapper X-Git-Tag: php-5.0.0RC3RC2~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23813d603c0e821875bfb50410719121a557c410;p=php Fixed off-by-one in http_fopen_wrapper --- diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index b2a3244b79..d45864fedd 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -498,7 +498,12 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path, char *s = strrchr(resource->path, '/'); if (!s) { s = resource->path; - *s = '/'; + if (!s[0]) { + efree(s); + s = resource->path = estrdup("/"); + } else { + *s = '/'; + } } s[1] = '\0'; if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') {