From: Felipe Pena Date: Tue, 26 Aug 2008 16:19:29 +0000 (+0000) Subject: - Improved fix X-Git-Tag: BEFORE_HEAD_NS_CHANGE~564 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20587099402490e0256463463e17d52db18ad7f6;p=php - Improved fix --- diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 0824ef1a96..475169166a 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -402,7 +402,7 @@ PHP_FUNCTION(finfo_set_flags) static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ { long options = 0; - char *buffer, *tmp, *ret_val; + char *tmp, *ret_val, *buffer = NULL; int buffer_len; struct php_fileinfo *finfo; zval *zfinfo, *zcontext = NULL; @@ -449,7 +449,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ * } else { /* local file */ char resolved_path[MAXPATHLEN]; - if (buffer_len && VCWD_REALPATH(buffer, resolved_path)) { + if (*buffer && VCWD_REALPATH(buffer, resolved_path)) { ret_val = (char *) magic_file(finfo->magic, buffer); } else { RETURN_FALSE; diff --git a/ext/fileinfo/tests/finfo_file_001.phpt b/ext/fileinfo/tests/finfo_file_001.phpt index 6ef8e27863..1cffa3b2f1 100644 --- a/ext/fileinfo/tests/finfo_file_001.phpt +++ b/ext/fileinfo/tests/finfo_file_001.phpt @@ -4,6 +4,7 @@ finfo_file(): Testing file names