]> granicus.if.org Git - php/commitdiff
Fix expand_filepath when including relative files, ideally you should test you code...
authorScott MacVicar <scottmac@php.net>
Tue, 9 Oct 2007 10:04:19 +0000 (10:04 +0000)
committerScott MacVicar <scottmac@php.net>
Tue, 9 Oct 2007 10:04:19 +0000 (10:04 +0000)
main/fopen_wrappers.c

index 920de5e8247afa5d4c65a0dfe099aff933f9d58d..265505acf5ba55ba23424042c1c6b27802180ae5 100644 (file)
@@ -593,8 +593,10 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC)
                                copy_len = strlen(filepath) > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : strlen(filepath);
                                real_path = estrndup(filepath, copy_len);
                                return real_path;
+                       } else {
+                               cwd[0] = '\0';
                        }
-               } else {
+               } else if (!result) {
                        cwd[0] = '\0';
                }
        }