You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Daniel R (JIRA)" <ji...@apache.org> on 2010/11/11 00:20:17 UTC

[jira] Created: (VFS-338) Possible crash in extractWindowsRootPrefix method

Possible crash in extractWindowsRootPrefix method
-------------------------------------------------

                 Key: VFS-338
                 URL: https://issues.apache.org/jira/browse/VFS-338
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 2.0
         Environment: Windows
            Reporter: Daniel R


extractWindowsRootPrefix method has a possible crash. Found it trying to get special windows working.

        if (startPos == maxlen && name.length() > startPos && name.charAt(startPos + 1) == '/')
        {
            // Too many '/'
            throw new FileSystemException("vfs.provider.local/not-absolute-file-name.error", uri);
        }

This should be something like so: 

        if (startPos == maxlen && name.length() > startPos && name.length() > (startPos + 1) && name.charAt(startPos + 1) == '/')
        {
            // Too many '/'
            throw new FileSystemException("vfs.provider.local/not-absolute-file-name.error", uri);
        }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Commented] (VFS-338) Possible crash in extractWindowsRootPrefix method

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VFS-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113925#comment-13113925 ] 

Ralph Goers commented on VFS-338:
---------------------------------

I don't have a Windows environment to test on. I am hesitant to apply a patch that is "something like" the provided code. Can you supply a patch and a test that verifies it? 

> Possible crash in extractWindowsRootPrefix method
> -------------------------------------------------
>
>                 Key: VFS-338
>                 URL: https://issues.apache.org/jira/browse/VFS-338
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: Windows
>            Reporter: Daniel R
>
> extractWindowsRootPrefix method has a possible crash. Found it trying to get special windows working.
>         if (startPos == maxlen && name.length() > startPos && name.charAt(startPos + 1) == '/')
>         {
>             // Too many '/'
>             throw new FileSystemException("vfs.provider.local/not-absolute-file-name.error", uri);
>         }
> This should be something like so: 
>         if (startPos == maxlen && name.length() > startPos && name.length() > (startPos + 1) && name.charAt(startPos + 1) == '/')
>         {
>             // Too many '/'
>             throw new FileSystemException("vfs.provider.local/not-absolute-file-name.error", uri);
>         }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira