VirtualBox

Changeset 77772 in vbox


Ignore:
Timestamp:
Mar 18, 2019 9:59:40 PM (6 years ago)
Author:
vboxsync
Message:

vfschain.cpp: Call memcpy only when there is something to copy to avoid ASAN runtime warnings (the spec says that passing NULL pointers is undefined even though most memcpy implementations shouldn't bother as long as the n argument is 0 as well)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfschain.cpp

    r76553 r77772  
    531531        }
    532532
    533         memcpy(paNew, pSpec->paElements, iElement * sizeof(paNew[0]));
     533        if (iElement)
     534            memcpy(paNew, pSpec->paElements, iElement * sizeof(paNew[0]));
    534535        RTMemTmpFree(pSpec->paElements);
    535536        pSpec->paElements = paNew;
     
    572573        if (!paNew)
    573574            return VERR_NO_TMP_MEMORY;
    574         memcpy(paNew, pElement->paArgs, iArg * sizeof(paNew[0]));
     575        if (iArg)
     576            memcpy(paNew, pElement->paArgs, iArg * sizeof(paNew[0]));
    575577        RTMemTmpFree(pElement->paArgs);
    576578        pElement->paArgs = paNew;
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