Ticket #3124: patch.1.diff

File patch.1.diff, 1.4 KB (added by Adek336, 16 years ago)
  • src/system/kernel/fs/vfs.cpp

     
    54705470            return B_BAD_ADDRESS;
    54715471
    54725472        ASSERT(entry->d_reclen >= sizeof(struct dirent));
     5473        ASSERT(entry->d_reclen <= sizeof(buffer));
    54735474
    54745475        if (user_memcpy(entry->d_name, userEntry->d_name,
    5475                 entry->d_reclen - sizeof(struct dirent)) != B_OK)
     5476                entry->d_reclen - sizeof(struct dirent) + 1) != B_OK)
    54765477            return B_BAD_ADDRESS;
    54775478    } else
    54785479        entry = userEntry;
  • src/libs/compat/freebsd_network/if.c

     
    6767void
    6868if_free(struct ifnet *ifp)
    6969{
     70    int clear;
     71    // if_index may be uninitialized
     72    if (gDeviceNameList[ifp->if_index] == ifp->device_name) {
     73        if (ifp->if_index == gDeviceCount - 1) {
     74            clear= ifp->if_index;
     75        } else {
     76            clear= gDeviceCount - 1;
     77            gDevices[ifp->if_index] = gDevices[clear];
     78            gDeviceNameList[ifp->if_index] = gDeviceNameList[clear];
     79            gDevices[ifp->if_index]->if_index = ifp->if_index;
     80        }
     81
     82        gDeviceNameList[clear] = 0;
     83        gDevices[clear] = 0;
     84        gDeviceCount--;
     85    }
     86   
    7087    IF_ADDR_LOCK_DESTROY(ifp);
    7188    if (ifp->if_type == IFT_ETHER)
    7289        _kernel_free(ifp->if_l2com);