summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-11-22 08:39:34 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-11-22 08:39:34 +0000
commit1b4c77835069067086bba32e9b8719c7fbb7a518 (patch)
tree4f3a27a8c3e68cd16015d5024041d5ebbca9f84e
parentaa035e8baac0b115fd39f4faae950aae5a256664 (diff)
fix a bug w/ choice_ipaddr() reply fine, but the loop goes on.
in other words, loop variable might get null on the list end while scoring variable still has the right value, which caused NULL to get passed into rarpd_reply() in ia arg, causing coredumps deeper in. no big deal, fixed; d@ looked over.
-rw-r--r--usr.sbin/rarpd/rarpd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c
index f870c467a76..0ddf439c38a 100644
--- a/usr.sbin/rarpd/rarpd.c
+++ b/usr.sbin/rarpd/rarpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rarpd.c,v 1.27 1999/10/29 07:27:40 niklas Exp $ */
+/* $OpenBSD: rarpd.c,v 1.28 1999/11/22 08:39:33 mickey Exp $ */
/* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */
/*
@@ -28,7 +28,7 @@ char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "$OpenBSD: rarpd.c,v 1.27 1999/10/29 07:27:40 niklas Exp $";
+static char rcsid[] = "$OpenBSD: rarpd.c,v 1.28 1999/11/22 08:39:33 mickey Exp $";
#endif
@@ -621,10 +621,12 @@ rarp_process(ii, pkt)
err(FATAL, "cannot handle non IP addresses");
/* NOTREACHED */
}
- for (target_ipaddr = 0, ia = ii->ii_addrs; target_ipaddr == 0 && ia;
- ia = ia->ia_next)
+ for (target_ipaddr = 0, ia = ii->ii_addrs; ia; ia = ia->ia_next) {
target_ipaddr = choose_ipaddr((u_int32_t **) hp->h_addr_list,
ia->ia_ipaddr & ia->ia_netmask, ia->ia_netmask);
+ if (target_ipaddr)
+ break;
+ }
if (target_ipaddr == 0) {
for (ia = ii->ii_addrs; ia; ia = ia->ia_next) {