hostdb: Fix iteration overrun