Fix another misuse of BOpenHashTable::Iterator
* This ioctl is used only in the arp command, but still we should keep it working * Similar to the problem in elf.cpp, this relied on entry being set to NULL when trying to iterate after the last element.
This commit is contained in:
@@ -885,14 +885,12 @@ arp_control(const char *subsystem, uint32 function, void *buffer,
|
||||
|
||||
arp_entry *entry = NULL;
|
||||
uint32 i = 0;
|
||||
while (iterator.HasNext() && i < control.cookie) {
|
||||
for (uint32 i = 0; i <= control.cookie; i++) {
|
||||
if (!iterator.HasNext())
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
entry = iterator.Next();
|
||||
i++;
|
||||
}
|
||||
|
||||
if (entry == NULL)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
control.cookie++;
|
||||
control.address = entry->protocol_address;
|
||||
if (entry->hardware_address.sdl_alen == ETHER_ADDRESS_LENGTH) {
|
||||
|
||||
Reference in New Issue
Block a user