[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Subversion 1.7.4 dirent_uri.c -- svn_uri_is_canonical returns TRUE for invalid file:/// URIs

From: Jim GMail <synapsepiano_at_gmail.com>
Date: Thu, 15 Mar 2012 13:19:20 -0400

Kind reader:

 

As far as I can tell, this does not apply to ISSUES 4099, 3609, or 2028, all of which reference svn_uri_is_canonical.

 

The following URIs return TRUE from svn_uri_is_canonical:

 

1) file:///MyHost/path

 

2) file:///C:dir/path

 

3) file:///c=dir/path

 

I believe the problem is with code at or about dirent_uri.c -- line 1795:

 

      /* If this is a file url, ptr now points to the third '/' in

         file:///C:/path. Check that if we have such a URL the drive

         letter is in uppercase. */

      if (strncmp(uri, "file:", 5) == 0 &&

          ! (*(ptr+1) >= 'A' && *(ptr+1) <= 'Z') &&

          *(ptr+2) == ':')

        return FALSE;

 

This condition evaluates to FALSE (and does not return FALSE) as soon as *(prt+1) is determined to be uppercase.

 

This renders the additional check *(ptr+2) == ':' as moot, but I believe this check is also invalid, as demonstrated by URI 3)
above. If *(ptr+2) != ':' the condition is still FALSE and the routine does not return FALSE as it should.

 

I respectfully submit the following correction for your consideration:

 

      if (strncmp(uri, "file:", 5) == 0 &&

          ! (*(ptr+1) >= 'A' && *(ptr+1) <= 'Z' &&

             *(ptr+2) == ':' && *(ptr+3) == '/')

   )

        return FALSE;

 

If you concur with my finding of this issue, I welcome hints, pointers, or guidance as to the proper way to raise this issue through
proper channels.

 

Thank you for your cycles,

 

Jim O'Leary
Received on 2012-03-15 18:26:23 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.