VirtualBox

Changeset 61578 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 8, 2016 2:09:27 PM (9 years ago)
Author:
vboxsync
Message:

Debugger/Digger/Linux: Fix for buffer overflow return code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGPlugInLinux.cpp

    r61572 r61578  
    420420
    421421    /** @todo: Try to parse where the single messages start to make use of cMessages. */
    422     memcpy(&pszBuf[0], pbLogBuf, RT_MIN(cbBuf, cbLogBuf));
     422    size_t cchLength = RTStrNLen((const char *)pbLogBuf, cbLogBuf);
     423    memcpy(&pszBuf[0], pbLogBuf, RT_MIN(cbBuf, cchLength));
    423424
    424425    /* Done with the buffer. */
     
    427428    /* Set return size value. */
    428429    if (pcbActual)
    429         *pcbActual = RT_MIN(cbBuf, cbLogBuf);
    430 
    431     return cbBuf <= cbLogBuf ? VINF_SUCCESS : VERR_BUFFER_OVERFLOW;
     430        *pcbActual = RT_MIN(cbBuf, cchLength);
     431
     432    return cbBuf <= cchLength ? VERR_BUFFER_OVERFLOW : VINF_SUCCESS;
    432433}
    433434
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