httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@hyperreal.org
Subject cvs commit: apache-1.3/src/os/win32 util_win32.c
Date Mon, 13 Jul 1998 07:06:18 GMT
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)
    */
   
  
  
  

Mime
View raw message