From: Ilia Alshanetsky Date: Tue, 20 Dec 2005 14:28:03 +0000 (+0000) Subject: MFH: Fixed bug #31347 (is_dir and is_file (incorrectly) return true for any X-Git-Tag: php-4.4.2RC2~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a46fb9b723432079ee6306e64c935c752581fc6;p=php MFH: Fixed bug #31347 (is_dir and is_file (incorrectly) return true for any string greater then 255 characters). --- diff --git a/TSRM/tsrm_config_common.h b/TSRM/tsrm_config_common.h index 23dc9bfd79..ea1eef11ca 100644 --- a/TSRM/tsrm_config_common.h +++ b/TSRM/tsrm_config_common.h @@ -42,6 +42,8 @@ char *alloca (); #ifndef MAXPATHLEN # ifdef PATH_MAX # define MAXPATHLEN PATH_MAX +# elif defined(MAX_PATH) +# define MAXPATHLEN MAX_PATH # else # define MAXPATHLEN 256 # endif diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c index d8560d5a62..a9382ac363 100644 --- a/TSRM/tsrm_virtual_cwd.c +++ b/TSRM/tsrm_virtual_cwd.c @@ -700,7 +700,9 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) int retval; 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); diff --git a/main/php.h b/main/php.h index 9b5a26cfd3..615b0c7b20 100644 --- a/main/php.h +++ b/main/php.h @@ -232,6 +232,8 @@ char *strerror(int); #ifndef MAXPATHLEN # ifdef PATH_MAX # define MAXPATHLEN PATH_MAX +# elif defined(MAX_PATH) +# define MAXPATHLEN MAX_PATH # else # define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */ # endif