VirtualBox

Changeset 88637 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 21, 2021 10:11:34 PM (4 years ago)
Author:
vboxsync
Message:

Main/SharedFolderImpl.cpp: Reject shared folder paths which have a
filename as their final component by performing additional pathname
vetting in the createSharedFolder() API back-end routine
SharedFolder::i_protectedInit().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp

    r82968 r88637  
    291291        if (RTPathCompare(hostPath.c_str(), hostPathFull) != 0)
    292292            return setError(E_INVALIDARG, tr("Shared folder path '%s' is not absolute"), hostPath.c_str());
     293
     294        RTFSOBJINFO ObjInfo;
     295        vrc = RTPathQueryInfo(hostPathFull, &ObjInfo, RTFSOBJATTRADD_NOTHING);
     296        if (RT_FAILURE(vrc))
     297            return setError(E_INVALIDARG, tr("RTPathQueryInfo failed on shared folder path '%s': %Rrc"), hostPathFull, vrc);
     298
     299        if (!RTFS_IS_DIRECTORY(ObjInfo.Attr.fMode))
     300            return setError(E_INVALIDARG, tr("Shared folder path '%s' is not a directory"), hostPathFull);
    293301    }
    294302
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette