VirtualBox

Changeset 51523 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 4, 2014 7:58:33 AM (11 years ago)
Author:
vboxsync
Message:

Additions/common/VBoxService: fix an assertion getting network interface information on 64-bit Linux guests.

File:
1 edited

Legend:

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

    r51503 r51523  
    11571157    while (cbLeft >= sizeof(*pCur))
    11581158    {
     1159# if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)
     1160        /* These two do not provide the sa_len member but only support address
     1161         * families which do not need extra bytes on the end. */
     1162#  define SA_LEN(pAddr) sizeof(struct sockaddr)
     1163# elif !defined(SA_LEN)
     1164#  define SA_LEN(pAddr) (pAddr)->sa_len
     1165# endif
    11591166        /* Figure the size of the current request. */
    1160         size_t cbCur = RT_OFFSETOF(struct ifreq, ifr_addr);
    1161 # if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) /* No sa_len on this platforms. */
     1167        size_t cbCur = RT_OFFSETOF(struct ifreq, ifr_addr)
     1168                     + SA_LEN(&pCur->ifr_addr);
     1169        cbCur = RT_MAX(cbCur, sizeof(struct ifreq));
     1170# if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)
    11621171        Assert(pCur->ifr_addr.sa_family == AF_INET);
    1163         cbCur += sizeof(struct sockaddr);
    1164 # else
    1165         cbCur += RT_MAX(sizeof(struct sockaddr), pCur->ifr_addr.sa_len);
    11661172# endif
    11671173        AssertBreak(cbCur <= cbLeft);
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