pcs 99/01/30 11:19:25
Modified: src CHANGES
src/os/win32 util_win32.c
Log:
Win32: The filename validity checker now allows "COM" but refuses access
to "COM1" through "COM4". This allows filenames such as "com.name" to be
served. If was supposed to work like this but a bug meant that the "COM1"
invalid filename was matching "COM". Similarly the check for "LPT1" would
have denied access to filenames with a "LPT" segment.
PR: 3769
Revision Changes Path
1.1228 +4 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1227
retrieving revision 1.1228
diff -u -r1.1227 -r1.1228
--- CHANGES 1999/01/28 18:27:17 1.1227
+++ CHANGES 1999/01/30 19:19:23 1.1228
@@ -1,5 +1,9 @@
Changes with Apache 1.3.5
+ *) Win32: The filename validity checker now allows "COM" but refuses
+ access to "COM1" through "COM4". This allows filenames such
+ as "com.name" to be served. [Paul Sutton] PR#3769.
+
*) BS2000: Adapt to the new ufork() system call interface which will
make subtasking easier on the OSD/POSIX mainframe environment.
[Martin Kraemer]
1.32 +5 -4 apache-1.3/src/os/win32/util_win32.c
Index: util_win32.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/os/win32/util_win32.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- util_win32.c 1999/01/05 08:17:32 1.31
+++ util_win32.c 1999/01/30 19:19:25 1.32
@@ -571,7 +571,7 @@
API_EXPORT(int) ap_os_is_filename_valid(const char *file)
{
const char *segstart;
- char seglength;
+ unsigned int seglength;
const char *pos;
static const char * const invalid_characters = "?\"<>*|:";
static const char * const invalid_filenames[] = {
@@ -621,8 +621,8 @@
}
while (*pos) {
- int idx;
- int baselength;
+ unsigned int idx;
+ unsigned int baselength;
while (*pos == '/' || *pos == '\\') {
pos++;
@@ -665,7 +665,8 @@
* if it does not include any dot characters). */
if (baselength == 3 || baselength == 4) {
for (idx = 0; invalid_filenames[idx]; idx++) {
- if (!strnicmp(invalid_filenames[idx], segstart, baselength)) {
+ if (strlen(invalid_filenames[idx]) == baselength &&
+ !strnicmp(invalid_filenames[idx], segstart, baselength)) {
return 0;
}
}