VirtualBox

Changeset 48287 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Sep 5, 2013 2:04:23 AM (11 years ago)
Author:
vboxsync
Message:

netif_create_ip6_linklocal_address: Don't access netif::hwaddr outside
its bounds when netif::hwaddr_len is less that 8.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/lwip-new/src/core/netif.c

    r47886 r48287  
    863863  }
    864864  else {
     865    u8_t *id;
     866
    865867    /* Use hwaddr directly as interface ID. */
    866868    netif->ip6_addr[0].addr[2] = 0;
    867869    netif->ip6_addr[0].addr[3] = 0;
    868870
    869     addr_index = 3;
    870     for (i = 0; i < 8; i++) {
    871       if (i == 4) {
    872         addr_index--;
    873       }
    874       netif->ip6_addr[0].addr[addr_index] |= ((u32_t)(netif->hwaddr[netif->hwaddr_len - i - 1])) << (8 * (i & 0x03));
     871    LWIP_ASSERT("bad netif->hwaddr_len",
     872                0 < netif->hwaddr_len && netif->hwaddr_len <= 8);
     873    id = (uint8_t *)&netif->ip6_addr[0].addr[2];
     874    id += 8 - netif->hwaddr_len;
     875    for (i = 0; i < netif->hwaddr_len; ++i) {
     876      id[i] = netif->hwaddr[i];
    875877    }
    876878  }
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