VirtualBox

Changeset 83958 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Apr 23, 2020 8:24:40 PM (5 years ago)
Author:
vboxsync
Message:

VBoxServiceVMInfo.cpp: Two NT4 fixes. First, the NT4 SP1 workaround for the uninitialized variable in GetTcpipInterfaceList wasn't active due to the lowercased x in RT_ARCH_X86. Second, we were walking a IP_ADAPTER_INFO list even when GetAdaptersInfo wasn't actually called or failed with ERROR_NO_DATA. Set the pAdpInfo and cbAdpInfo variables to NULL and 0 in that case, as the code expects it to be (see NULL checks before the strcmp loop we crashed, or in one instance point got stuck, in). Also, initialize the buffers with zeros. bugref:8489

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r83235 r83958  
    943943
    944944    ULONG            cbAdpInfo = sizeof(IP_ADAPTER_INFO);
    945     IP_ADAPTER_INFO *pAdpInfo  = (IP_ADAPTER_INFO *)RTMemAlloc(cbAdpInfo);
     945    IP_ADAPTER_INFO *pAdpInfo  = (IP_ADAPTER_INFO *)RTMemAllocZ(cbAdpInfo);
    946946    if (!pAdpInfo)
    947947    {
     
    956956        {
    957957            pAdpInfo = pAdpInfoNew;
     958            RT_BZERO(pAdpInfo, cbAdpInfo);
    958959            dwRet = g_pfnGetAdaptersInfo(pAdpInfo, &cbAdpInfo);
    959960        }
     
    965966        /* If no network adapters available / present in the
    966967         * system we pretend success to not bail out too early. */
    967         dwRet = ERROR_SUCCESS;
     968        RTMemFree(pAdpInfo);
     969        pAdpInfo  = NULL;
     970        cbAdpInfo = 0;
     971        dwRet     = ERROR_SUCCESS;
    968972    }
    969973    if (dwRet != ERROR_SUCCESS)
     
    994998    INTERFACE_INFO  aInterfaces[20] = {0};
    995999    DWORD           cbReturned      = 0;
    996 # ifdef RT_ARCH_x86
     1000# ifdef RT_ARCH_X86
    9971001    /* Workaround for uninitialized variable used in memcpy in GetTcpipInterfaceList
    9981002       (NT4SP1 at least).  It seems to be happy enough with garbages, no failure
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