View Issue Details

IDProjectCategoryView StatusLast Update
0003440mantisbtbugtrackerpublic2004-02-29 07:20
Reporterhassan Assigned Tovboctor  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.18.0a4 
Summary0003440: "Allowed File Types" is case sensitive
Description

I set my config.php file the way that it allows "zip" type files. It happened that for one of the bug i tried to upload "error.ZIP" file and it's rejected by the Mantis saying that file type not allowed.

I simple changed the file name to "error.zip" and it worked.

Additional Information

Mantis v0.18.0a4
PHP: 4.3.3-win32
Apache: 1.3.27

TagsNo tags attached.
Attached Files
3440_allowed_disallowed_files_are_case_sensitive.diff (1,120 bytes)   
Index: core/file_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/file_api.php,v
retrieving revision 1.40
diff -u -r1.40 file_api.php
--- core/file_api.php	11 Jan 2004 07:16:10 -0000	1.40
+++ core/file_api.php	8 Feb 2004 08:28:49 -0000
@@ -308,22 +308,24 @@
 		# check against disallowed files
 		$t_disallowed_arr =  explode_enum_string( $t_disallowed_files );
 		foreach ( $t_disallowed_arr as $t_val ) {
-		    if ( $t_val == $t_extension ) {
-		    	return false;
-		    }
+			if ( strcasecmp( $t_val, $t_extension ) == 0 ) {
+				return false;
+			}
 		}
 
 		# if the allowed list is note populated then the file must be allowed
 		if ( is_blank( $t_allowed_files ) ) {
 			return true;
 		}
+
 		# check against allowed files
 		$t_allowed_arr = explode_enum_string( $t_allowed_files );
 		foreach ( $t_allowed_arr as $t_val ) {
-		    if ( $t_val == $t_extension ) {
+			if ( strcasecmp( $t_val, $t_extension ) == 0 ) {
 				return true;
-		    }
+			}
 		}
+
 		return false;
 	}
 	# --------------------

Activities

vboctor

vboctor

2004-02-08 03:37

manager   ~0004981

Patch attached and fixed in CVS. Will be available in the next release.