]> granicus.if.org Git - php/commitdiff
Fixed off-by-one in http_fopen_wrapper
authorStefan Esser <sesser@php.net>
Fri, 28 May 2004 13:38:06 +0000 (13:38 +0000)
committerStefan Esser <sesser@php.net>
Fri, 28 May 2004 13:38:06 +0000 (13:38 +0000)
ext/standard/http_fopen_wrapper.c

index b2a3244b79fbcec1357a325e782fb9186cbc1760..d45864fedd137a757ec5adb48c6fd72b2beaf3df 100644 (file)
@@ -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') {