You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 1998/07/13 05:02:17 UTC

cvs commit: apache-1.3/src/os/win32 util_win32.c

marc        98/07/12 20:02:16

  Modified:    src/os/win32 util_win32.c
  Log:
  Give a proper error message in os_stat if we get something that
  doesn't have a drive letter and isn't UNC instead of dumping with
  a very unrewarding ap_assert().
  
  Revision  Changes    Path
  1.21      +10 -1     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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- util_win32.c	1998/07/08 17:47:25	1.20
  +++ util_win32.c	1998/07/13 03:02:16	1.21
  @@ -3,6 +3,7 @@
   #include <stdarg.h>
   
   #include "httpd.h"
  +#include "http_log.h"
   
   /* Returns TRUE if the path is real, FALSE if it is PATH_INFO */
   static BOOL sub_canonical_filename(char *szCanon, unsigned nCanon, const char *szFile)
  @@ -151,7 +152,15 @@
   {
       int n;
   
  -    ap_assert(szPath[1] == ':' || szPath[1] == '/');	// we are dealing with either UNC or a drive
  +    /* be sure it is has a drive letter or is a UNC path; everything
  +     * _must_ be canonicalized before getting to this point.  
  +     */
  +    if (szPath[1] != ':' && szPath[1] != '/') {
  +	ap_log_error(APLOG_MARK, APLOG_ERR, NULL, 
  +	    "Invalid path in os_stat: \"%s\", should have a drive letter "
  +	    "or be a UNC path", szPath);
  +	return (-1);
  +    }
   
       if(szPath[0] == '/') {
   	char buf[_MAX_PATH];