httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject [1.3 PATCH/QUESTION] Win32 ap_os_is_filename_valid()
Date Wed, 27 Feb 2002 20:16:27 GMT
This function is checking for several characters which, at least in
ASCII, are supposedly not valid characters for filenames.  But some of
these same characters can appear in valid non-ASCII filenames, and the
logic to check for these characters breaks Apache's ability to serve
those files.

A user reported the inability to request a file with the Chinese
character %b5%7c in the name.  The %7c byte tripped up the check for
invalid ASCII characters.

Is that logic actually useful for anything?  Why wouldn't we let the
OS try to open the file and decide whether or not it works?

Index: os/win32/util_win32.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/os/win32/util_win32.c,v
retrieving revision 1.44
diff -u -r1.44 util_win32.c
--- os/win32/util_win32.c	10 May 2001 04:07:57 -0000	1.44
+++ os/win32/util_win32.c	27 Feb 2002 20:06:13 -0000
@@ -400,7 +400,6 @@
     const char *segstart;
     unsigned int seglength;
     const char *pos;
-    static const char * const invalid_characters = "?\"<>*|:";
     static const char * const invalid_filenames[] = { 
 	"CON", "AUX", "COM1", "COM2", "COM3", 
 	"COM4", "LPT1", "LPT2", "LPT3", "PRN", "NUL", NULL 
@@ -469,8 +468,7 @@
 
 	/* Test 2 */
 	for (idx = 0; idx < seglength; idx++) {
-	    if ((segstart[idx] > 0 && segstart[idx] < 32) ||
-		strchr(invalid_characters, segstart[idx])) {
+	    if ((segstart[idx] > 0 && segstart[idx] < 32)) {
 		return 0;
 	    }
 	}
@@ -569,4 +567,4 @@
     return errstr;
 }
 
-#endif /* WIN32 */
\ No newline at end of file
+#endif /* WIN32 */

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message