VirtualBox

Changeset 35641 in vbox


Ignore:
Timestamp:
Jan 19, 2011 9:06:21 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69550
Message:

Main/NetIf: Fixed VBoxSVC crash when listing host interfaces with no default route (#5491)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp

    r28800 r35641  
    153153
    154154#define ROUNDUP(a) \
    155         ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
     155        ((a) > 0 ? (1 + (((a) - 1) | (sizeof(u_long) - 1))) : sizeof(u_long))
    156156#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
    157157
     
    161161
    162162    for (int i = 0; i < RTAX_MAX && cp < cplim; i++) {
    163         if (!(iAddrMask & (1 << i)))
    164             continue;
    165 
    166         sa = (struct sockaddr *)cp;
    167 
    168         pAddresses[i] = sa;
    169 
    170         ADVANCE(cp, sa);
     163        if (iAddrMask & (1 << i))
     164        {
     165            sa = (struct sockaddr *)cp;
     166
     167            pAddresses[i] = sa;
     168
     169            ADVANCE(cp, sa);
     170        }
     171        else
     172            pAddresses[i] = NULL;
    171173    }
    172174}
     
    249251            extractAddresses(pRtMsg->rtm_addrs, (char *)(pRtMsg + 1),
    250252                             pRtMsg->rtm_msglen + (char *)pRtMsg, addresses);
    251             if ((pRtMsg->rtm_addrs & RTA_DST))
     253            if ((pRtMsg->rtm_addrs & RTA_DST)
     254                && (pRtMsg->rtm_addrs & RTA_NETMASK))
    252255            {
    253256                if (addresses[RTAX_DST]->sa_family != AF_INET)
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