mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Fixed bug #31347 (is_dir and is_file (incorrectly) return true for any string
greater then 255 characters).
This commit is contained in:
parent
efff8a45e2
commit
5df2f5df42
@ -42,6 +42,8 @@ char *alloca ();
|
|||||||
#ifndef MAXPATHLEN
|
#ifndef MAXPATHLEN
|
||||||
# ifdef PATH_MAX
|
# ifdef PATH_MAX
|
||||||
# define MAXPATHLEN PATH_MAX
|
# define MAXPATHLEN PATH_MAX
|
||||||
|
# elif defined(MAX_PATH)
|
||||||
|
# define MAXPATHLEN MAX_PATH
|
||||||
# else
|
# else
|
||||||
# define MAXPATHLEN 256
|
# define MAXPATHLEN 256
|
||||||
# endif
|
# endif
|
||||||
|
@ -478,13 +478,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
|||||||
#endif
|
#endif
|
||||||
#if defined(TSRM_WIN32)
|
#if defined(TSRM_WIN32)
|
||||||
{
|
{
|
||||||
char *dummy = NULL;
|
|
||||||
int new_path_length;
|
int new_path_length;
|
||||||
|
|
||||||
new_path_length = GetLongPathName(path, dummy, 0) + 1;
|
new_path_length = GetLongPathName(path, NULL, 0);
|
||||||
if (new_path_length == 0) {
|
if (new_path_length == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GetLongPathName already counts the \0 */
|
||||||
new_path = (char *) malloc(new_path_length);
|
new_path = (char *) malloc(new_path_length);
|
||||||
if (!new_path) {
|
if (!new_path) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -856,7 +857,9 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC)
|
|||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||||
virtual_file_ex(&new_state, path, NULL, 1);
|
if (virtual_file_ex(&new_state, path, NULL, 1)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
retval = stat(new_state.cwd, buf);
|
retval = stat(new_state.cwd, buf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user