felipe          Tue Aug 26 15:03:33 2008 UTC

  Added files:                 
    /php-src/ext/fileinfo/tests finfo_file_001.phpt 

  Modified files:              
    /php-src/ext/fileinfo       fileinfo.c 
  Log:
  - Added check for empty file name
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/fileinfo.c?r1=1.23&r2=1.24&diff_format=u
Index: php-src/ext/fileinfo/fileinfo.c
diff -u php-src/ext/fileinfo/fileinfo.c:1.23 
php-src/ext/fileinfo/fileinfo.c:1.24
--- php-src/ext/fileinfo/fileinfo.c:1.23        Fri Jul 25 15:20:58 2008
+++ php-src/ext/fileinfo/fileinfo.c     Tue Aug 26 15:03:33 2008
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: fileinfo.c,v 1.23 2008/07/25 15:20:58 felipe Exp $ */
+/* $Id: fileinfo.c,v 1.24 2008/08/26 15:03:33 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -448,11 +448,12 @@
                        }
                } else { /* local file */
                        char resolved_path[MAXPATHLEN];
-                       if (!VCWD_REALPATH(buffer, resolved_path)) {
+
+                       if (buffer_len && VCWD_REALPATH(buffer, resolved_path)) 
{
+                               ret_val = (char *) magic_file(finfo->magic, 
buffer);
+                       } else {
                                RETURN_FALSE;
                        }
-
-                       ret_val = (char *) magic_file(finfo->magic, buffer);
                        goto common;
                }
        } else { /* buffer */

http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/tests/finfo_file_001.phpt?view=markup&rev=1.1
Index: php-src/ext/fileinfo/tests/finfo_file_001.phpt
+++ php-src/ext/fileinfo/tests/finfo_file_001.phpt
--TEST--
finfo_file(): Testing file names
--FILE--
<?php

$fp = finfo_open();
var_dump(finfo_file($fp, ''));
var_dump(finfo_file($fp, NULL));
var_dump(finfo_file($fp, '.'));
var_dump(finfo_file($fp, '&'));

?>
--EXPECT--
bool(false)
bool(false)
string(9) "directory"
bool(false)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to