VirtualBox

Changeset 78417 in vbox for trunk/src/VBox/Main/glue


Ignore:
Timestamp:
May 6, 2019 11:24:31 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
130414
Message:

Utf8Str,RTCString: Assert that C-string pointer parameters in assignment type operations don't point into the object they're being assigned to, as that will lead to use-afer-free situations. bugref:9448

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/glue/string.cpp

    r76553 r78417  
    328328 * @param   a_pcszSrc   The source string.
    329329 * @param   a_offSrc    Start offset to copy from.
    330  * @param   a_cchSrc    The source string.
     330 * @param   a_cchSrc    How much to copy
    331331 * @returns S_OK or E_OUTOFMEMORY.
    332332 *
     
    336336HRESULT Utf8Str::copyFromExNComRC(const char *a_pcszSrc, size_t a_offSrc, size_t a_cchSrc)
    337337{
     338    Assert(!a_cchSrc || !m_psz || (uintptr_t)&a_pcszSrc[a_offSrc] - (uintptr_t)m_psz >= (uintptr_t)m_cbAllocated);
    338339    cleanup();
    339340    if (a_cchSrc)
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