summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-10-05 08:03:11 +0000
committerDmitry Stogov <dmitry@php.net>2006-10-05 08:03:11 +0000
commitcb1f58e39df7c814774c0a5a7acd606699d33859 (patch)
tree942788b4ebf98d3e4ff0e7fdb72b77657f242a3d
parent0d9f9b67b766a8c1ae0b1bc9e5f8c71226c77603 (diff)
downloadphp-git-cb1f58e39df7c814774c0a5a7acd606699d33859.tar.gz
Fixed bug #38989 (Absolute path with slash at beginning doesn't work on win)
-rw-r--r--NEWS2
-rw-r--r--TSRM/tsrm_virtual_cwd.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index bb0e30b0a6..63b560d759 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,8 @@ PHP NEWS
- Fixed bug #38996 (PDO_MYSQL doesn't check connections for liveness). (Tony)
- Fixed bug #38993 (Fixed safe_mode/open_basedir checks for
session.save_path, allowing them to account for extra parameters). (Ilia)
+- Fixed bug #38989 (Absolute path with slash at beginning doesn't work on win).
+ (Dmitry)
- Fixed bug #38981 (using FTP URLs in get_headers() causes crash). (Tony)
- Fixed bug #38961 (metaphone() results in segmentation fault on NetBSD).
(Tony)
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index 422c993586..54ae9a75ff 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -386,14 +386,21 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
* This can happen under solaris when a dir does not have read permissions
* but *does* have execute permissions */
if (!IS_ABSOLUTE_PATH(path, path_length) && (state->cwd_length > 1)) {
- int orig_path_len = path_length + state->cwd_length + 1;
+ int orig_path_len;
+ int state_cwd_length = state->cwd_length;
+#ifdef TSRM_WIN32
+ if (IS_SLASH(path[0])) {
+ state_cwd_length = 2;
+ }
+#endif
+ orig_path_len = path_length + state_cwd_length + 1;
if (orig_path_len >= MAXPATHLEN) {
return 1;
}
- memcpy(orig_path, state->cwd, state->cwd_length);
- orig_path[state->cwd_length] = DEFAULT_SLASH;
- memcpy(orig_path + state->cwd_length + 1, path, path_length + 1);
+ memcpy(orig_path, state->cwd, state_cwd_length);
+ orig_path[state_cwd_length] = DEFAULT_SLASH;
+ memcpy(orig_path + state_cwd_length + 1, path, path_length + 1);
path = orig_path;
path_length = orig_path_len;
}