VirtualBox

Changeset 32202 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 2, 2010 2:02:13 PM (14 years ago)
Author:
vboxsync
Message:

RTCoreDumper: fix potential crash with reading passed buffer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp

    r32197 r32202  
    10921092    NOREF(pVBoxCore);
    10931093
     1094    CORELOG((CORELOG_NAME ":suspendThread %d\n", (lwpid_t)pThreadInfo->pr_lwpid));
     1095
    10941096    lwpsinfo_t *pThreadInfo = (lwpsinfo_t *)pvThreadInfo;
    1095     CORELOGRELSYS((CORELOG_NAME ":suspendThread %d\n", (lwpid_t)pThreadInfo->pr_lwpid));
    10961097    if ((lwpid_t)pThreadInfo->pr_lwpid != pVBoxCore->VBoxProc.hCurThread)
    10971098        _lwp_suspend(pThreadInfo->pr_lwpid);
     
    11121113    AssertPtrReturn(pvThreadInfo, VERR_INVALID_POINTER);
    11131114    NOREF(pVBoxCore);
     1115
     1116    CORELOG((CORELOG_NAME ":resumeThread %d\n", (lwpid_t)pThreadInfo->pr_lwpid));
    11141117
    11151118    lwpsinfo_t *pThreadInfo = (lwpsinfo_t *)pvThreadInfo;
     
    13721375    ElfNoteHdr.achName[2] = 'R';
    13731376    ElfNoteHdr.achName[3] = 'E';
     1377
     1378    static const char s_achPad[3] = { 0, 0, 0 };
     1379    size_t cbAlign = RT_ALIGN_Z(cb, 4);
    13741380    ElfNoteHdr.Hdr.n_namesz = 5;
    13751381    ElfNoteHdr.Hdr.n_type = Type;
    1376     ElfNoteHdr.Hdr.n_descsz = RT_ALIGN_Z(cb, 4);
     1382    ElfNoteHdr.Hdr.n_descsz = cbAlign;
    13771383
    13781384    /*
     
    13811387    rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, &ElfNoteHdr, sizeof(ElfNoteHdr));
    13821388    if (RT_SUCCESS(rc))
    1383        rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, pcv, ElfNoteHdr.Hdr.n_descsz);
     1389    {
     1390       rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, pcv, cb);
     1391       if (RT_SUCCESS(rc))
     1392       {
     1393           if (cbAlign > cb)
     1394               rc = pVBoxCore->pfnWriter(pVBoxCore->hCoreFile, s_achPad, cbAlign - cb);
     1395       }
     1396    }
    13841397
    13851398    if (RT_FAILURE(rc))
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