VirtualBox

Changeset 77227 in vbox


Ignore:
Timestamp:
Feb 8, 2019 5:53:04 PM (6 years ago)
Author:
vboxsync
Message:

Guest Control/Main + FE/Qt: Be more strict for IGuestSession::copyToGuest() / copyFromGuest() and set/validate the filters + flags.

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerGuestTable.cpp

    r76626 r77227  
    324324
    325325void UIFileManagerGuestTable::copyHostToGuest(const QStringList &hostSourcePathList,
    326                                         const QString &strDestination /* = QString() */)
     326                                              const QString &strDestination /* = QString() */)
    327327{
    328328    if (!checkGuestSession())
    329329        return;
    330330    QVector<QString> sourcePaths = hostSourcePathList.toVector();
    331     QVector<QString>  aFilters;
    332     QVector<QString>  aFlags;
     331    QVector<QString> aFilters;
     332    aFilters.resize(sourcePaths.size()); /* Make sure to match the number of sources, even if empty. */
     333    QVector<QString> aFlags;
     334    aFlags.resize(sourcePaths.size());   /* Ditto. */
    333335    QString strDestinationPath = strDestination;
    334336    if (strDestinationPath.isEmpty())
     
    357359        return;
    358360    QVector<QString> sourcePaths = selectedItemPathList().toVector();
    359     QVector<QString>  aFilters;
    360     QVector<QString>  aFlags;
     361    QVector<QString> aFilters;
     362    aFilters.resize(sourcePaths.size()); /* Make sure to match the number of sources, even if empty. */
     363    QVector<QString> aFlags;
     364    aFlags.resize(sourcePaths.size());   /* Ditto. */
    361365
    362366    if (hostDestinationPath.isEmpty())
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r77093 r77227  
    29072907
    29082908    const size_t cSources = aSources.size();
    2909     if (   (aFilters.size() && aFilters.size() != cSources)
    2910         || (aFlags.size()   && aFlags.size()   != cSources))
    2911     {
    2912         return setError(E_INVALIDARG, tr("Parameter array sizes don't match to the number of sources specified"));
     2909    if (!cSources)
     2910        return setError(E_INVALIDARG, tr("No sources specified"));
     2911
     2912    if (   (aFilters.size() != cSources)
     2913        || (aFlags.size()   != cSources))
     2914    {
     2915        return setError(E_INVALIDARG, tr("Filter / flag parameter array sizes don't match to the number of sources specified"));
    29132916    }
    29142917
     
    29862989
    29872990    const size_t cSources = aSources.size();
    2988     if (   (aFilters.size() && aFilters.size() != cSources)
    2989         || (aFlags.size()   && aFlags.size()   != cSources))
    2990     {
    2991         return setError(E_INVALIDARG, tr("Parameter array sizes don't match to the number of sources specified"));
     2991    if (!cSources)
     2992        return setError(E_INVALIDARG, tr("No sources specified"));
     2993
     2994    if (   (aFilters.size() != cSources)
     2995        || (aFlags.size()   != cSources))
     2996    {
     2997        return setError(E_INVALIDARG, tr("Filter / flag parameter array sizes don't match to the number of sources specified"));
    29922998    }
    29932999
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