Return-Path: Delivered-To: apache-cvs-archive@hyperreal.org Received: (qmail 14688 invoked by uid 6000); 13 Jul 1998 07:06:21 -0000 Received: (qmail 14674 invoked by alias); 13 Jul 1998 07:06:19 -0000 Delivered-To: apache-1.3-cvs@hyperreal.org Received: (qmail 14670 invoked by uid 149); 13 Jul 1998 07:06:18 -0000 Date: 13 Jul 1998 07:06:18 -0000 Message-ID: <19980713070618.14669.qmail@hyperreal.org> From: marc@hyperreal.org To: apache-1.3-cvs@hyperreal.org Subject: cvs commit: apache-1.3/src/os/win32 util_win32.c Sender: apache-cvs-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org marc 98/07/13 00:06:17 Modified: src/os/win32 util_win32.c Log: Add some comments and error checking code to avoid wild memcpy. This doesn't fix any of the code, just makes it hurt less. Major bogosity here. Revision Changes Path 1.22 +9 -5 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.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- util_win32.c 1998/07/13 03:02:16 1.21 +++ util_win32.c 1998/07/13 07:06:16 1.22 @@ -62,6 +62,8 @@ char b2[_MAX_PATH]; char b3[_MAX_PATH]; ap_assert(szFilePart > buf+3); + /* avoid SEGVs on things like "Directory *" */ + ap_assert(s >= szFile && "this is a known bug"); memcpy(b3,szFile,s-szFile); b3[s-szFile]='\0'; @@ -94,9 +96,9 @@ } } -/* UNC requires backslashes, hence the conversion before canonicalisation. Not sure how - * many backslashes (could be that \\machine\share\some/path/is/ok for example). For now, do - * them all. +/* UNC requires backslashes, hence the conversion before canonicalisation. + * Not sure how * many backslashes (could be that + * \\machine\share\some/path/is/ok for example). For now, do them all. */ API_EXPORT(char *) ap_os_canonical_filename(pool *pPool, const char *szFile) { @@ -127,6 +129,7 @@ // Finally, a trailing slash(es) screws thing, so blow them away for(nSlashes=0 ; d > b2 && d[-1] == '\\' ; --d,++nSlashes) ; + /* XXXX this breaks '/' and 'c:/' cases */ *d='\0'; sub_canonical_filename(buf, sizeof buf, b2); @@ -142,8 +145,9 @@ /* Win95 doesn't like trailing /s. NT and Unix don't mind. This works * around the problem. - * Errr... except if it is UNC and we are referring to the root of the UNC, we MUST have - * a trailing \ and we can't use /s. Jeez. Not sure if this refers to all UNCs or just roots, + * Errr... except if it is UNC and we are referring to the root of + * the UNC, we MUST have a trailing \ and we can't use /s. Jeez. + * Not sure if this refers to all UNCs or just roots, * but I'm going to fix it for all cases for now. (Ben) */