VirtualBox

Changeset 108028 in vbox for trunk/src


Ignore:
Timestamp:
Feb 3, 2025 3:56:40 PM (3 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167301
Message:

Runtime/RTScriptLex*: Fix filling the buffer and zeroing the remainder under certain circumstances, bugref:10733

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/script/scriptlex.cpp

    r108014 r108028  
    375375
    376376    /* If there is input left to process move it to the front and fill the remainder. */
    377     if (pThis->pchCur != NULL)
     377    if (   pThis->pchCur != NULL
     378        && pThis->pchCur != &pThis->achBuf[pThis->cchBuf])
    378379    {
    379380        cchToRead = pThis->pchCur - &pThis->achBuf[0];
     
    381382        memmove(&pThis->achBuf[0], pThis->pchCur, pThis->cchBuf - cchToRead);
    382383        pchRead = (char *)pThis->pchCur + 1;
    383         memset(pchRead, 0, cchToRead);
    384384    }
    385385
     
    395395            if (rc == VINF_EOF)
    396396                pThis->fFlags |= RTSCRIPT_LEX_INT_F_EOS;
     397            if (cchRead < cchToRead)
     398                memset(pchRead + cchRead, 0, cchToRead - cchRead);
    397399            rc = VINF_SUCCESS;
    398400        }
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