VirtualBox

Changeset 46337 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
May 31, 2013 9:53:13 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86123
Message:

Main/OVF: added a sanity check for the size of OVF filenames to prevent creating invalid appliances if the VM name is too long

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r46290 r46337  
    324324            LONG64  llSize = 0;
    325325
    326             if (deviceType == DeviceType_HardDisk
    327                  && pMedium)
     326            if (   deviceType == DeviceType_HardDisk
     327                && pMedium)
    328328            {
    329329                Bstr bstrLocation;
     
    348348                Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().stripExt();
    349349                strTargetVmdkName = Utf8StrFmt("%s-disk%d.vmdk", strTargetName.c_str(), ++pAppliance->m->cDisks);
     350                if (strTargetVmdkName.length() > RTTAR_NAME_MAX)
     351                    throw setError(VBOX_E_NOT_SUPPORTED,
     352                                tr("Cannot attach disk '%s' -- file name too long"), strTargetVmdkName.c_str());
    350353
    351354                // force reading state, or else size will be returned as 0
     
    357360                if (FAILED(rc)) throw rc;
    358361            }
    359             else if (deviceType == DeviceType_DVD
    360                       && pMedium)
     362            else if (   deviceType == DeviceType_DVD
     363                     && pMedium)
    361364            {
    362365                Bstr bstrLocation;
     
    381384                Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().stripExt();
    382385                strTargetVmdkName = Utf8StrFmt("%s-disk%d.iso", strTargetName.c_str(), ++pAppliance->m->cDisks);
     386                if (strTargetVmdkName.length() > RTTAR_NAME_MAX)
     387                    throw setError(VBOX_E_NOT_SUPPORTED,
     388                                tr("Cannot attach image '%s' -- file name too long"), strTargetVmdkName.c_str());
    383389
    384390                // force reading state, or else size will be returned as 0
Note: See TracChangeset for help on using the changeset viewer.

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