apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 filepath.c
Date Tue, 10 Apr 2001 05:34:12 GMT
wrowe       01/04/09 22:34:12

  Modified:    file_io/win32 filepath.c
  Log:
    Fix two minor bogosities, the case folding of directory names and my
    first two bugs in this code.  Still needs some canonicalization and
    some major vetting.
  
  Revision  Changes    Path
  1.3       +11 -4     apr/file_io/win32/filepath.c
  
  Index: filepath.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filepath.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- filepath.c	2001/04/10 05:11:32	1.2
  +++ filepath.c	2001/04/10 05:34:12	1.3
  @@ -354,9 +354,15 @@
       if (is_fnchar(*testpath) && testpath[1] == ':') 
       {
           apr_status_t rv;
  -        /* Validate that d:\ drive exists, test must be rooted
  -         */
  -        newpath = apr_pstrndup(p, testpath, 3);
  +        /* Validate that D:\ drive exists, test must be rooted
  +         * Note that posix/win32 insists a drive letter is upper case,
  +         * so who are we to argue with a 'feature' we might exploit.
  +         * It is a safe fold, since only A-Z is legal, and has no
  +         * side effects of legal mis-mapped non-us-ascii codes.
  +         */
  +        newpath = apr_palloc(p, 3);
  +        newpath[0] = toupper(testpath[0]);
  +        newpath[1] = ':';
           newpath[2] = '\\';
           newpath[3] = '\0';
           rv = apr_filepath_root_test(newpath, p);
  @@ -819,7 +825,8 @@
            * we better be sure that /foo wasn't replaced with /foobar!
            */
           if (basepath[baselen - 1] != '/' && basepath[baselen - 1] != '\\'
  -             && path[baselen] && path[baselen] != '/' && path[baselen]
!= '\\')
  +                && path[rootlen + baselen] && path[rootlen + baselen] !=
'/' 
  +                                           && path[rootlen + baselen] != '\\')
               return APR_EABOVEROOT;
       }
   
  
  
  

Mime
View raw message