mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #51860 (Include fails with toplevel symlink to /)
This commit is contained in:
parent
33863b2cf8
commit
2c90b8a06b
1
NEWS
1
NEWS
@ -4,6 +4,7 @@ PHP NEWS
|
||||
- Core:
|
||||
. Fix bug #60895 (Possible invalid handler usage in windows random
|
||||
functions). (Pierre)
|
||||
. Fixed bug #51860 (Include fails with toplevel symlink to /). (Dmitry)
|
||||
|
||||
- OpenSSL:
|
||||
. Fix possible attack in SSL sockets with SSL 3.0 / TLS 1.0.
|
||||
|
@ -760,6 +760,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
|
||||
while (1) {
|
||||
if (len <= start) {
|
||||
if (link_is_dir) {
|
||||
*link_is_dir = 1;
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
@ -776,6 +779,10 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
continue;
|
||||
} else if (i == len - 2 && path[i] == '.' && path[i+1] == '.') {
|
||||
/* remove '..' and previous directory */
|
||||
is_dir = 1;
|
||||
if (link_is_dir) {
|
||||
*link_is_dir = 1;
|
||||
}
|
||||
if (i - 1 <= start) {
|
||||
return start ? start : len;
|
||||
}
|
||||
@ -1200,9 +1207,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
return 1;
|
||||
}
|
||||
memcpy(resolved_path, state->cwd, state_cwd_length);
|
||||
resolved_path[state_cwd_length] = DEFAULT_SLASH;
|
||||
memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1);
|
||||
path_length += state_cwd_length + 1;
|
||||
if (resolved_path[state_cwd_length-1] == DEFAULT_SLASH) {
|
||||
memcpy(resolved_path + state_cwd_length, path, path_length + 1);
|
||||
path_length += state_cwd_length;
|
||||
} else {
|
||||
resolved_path[state_cwd_length] = DEFAULT_SLASH;
|
||||
memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1);
|
||||
path_length += state_cwd_length + 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef TSRM_WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user