VirtualBox

Changeset 28394 in vbox for trunk


Ignore:
Timestamp:
Apr 16, 2010 7:09:47 AM (15 years ago)
Author:
vboxsync
Message:

NAT: paranoid border check.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/misc.c

    r28175 r28394  
    217217    Assert(it->magic == ITEM_MAGIC);
    218218    zone = it->zone;
     219    /* check bourder magic */
     220    Assert((*(uint32_t *)(((uint8_t *)&it[1]) + zone->size) == 0xabadbabe));
    219221    RTCritSectEnter(&zone->csZone);
    220222    Assert(zone->magic == ZONE_MAGIC);
     
    278280    struct item *it;
    279281    zone->max_items = max;
    280     zone->area = RTMemAllocZ(max * (sizeof(struct item) + zone->size));
     282    zone->area = RTMemAllocZ(max * (sizeof(struct item) + zone->size + sizeof(uint32_t)));
    281283    for (; i < max; ++i)
    282284    {
    283         it = (struct item *)(((uint8_t *)zone->area) + i*(sizeof(struct item) + zone->size));
     285        it = (struct item *)(((uint8_t *)zone->area) + i*(sizeof(struct item) + zone->size + sizeof(uint32_t)));
    284286        it->magic = ITEM_MAGIC;
    285287        it->zone = zone;
     288        *(uint32_t *)(((uint8_t *)&it[1]) + zone->size) = 0xabadbabe;
    286289        LIST_INSERT_HEAD(&zone->free_items, it, list);
    287290    }
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