From b6fcb4fec3bc56bca6493436c67288104dad2c92 Mon Sep 17 00:00:00 2001
From: Dima Dorfman
Date: Wed, 2 Oct 2002 02:17:59 +0000
Subject: [PATCH] Don't crash when the user feeds us nonesense in the form:
ifconfig IF ether WHATEVER -alias
PR: 42544
Submitted by: Mike Makonnen
---
sbin/ifconfig/ifconfig.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 35ac555e4f67..49ae26b84487 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -965,9 +965,10 @@ void
notealias(const char *addr, int param, int s, const struct afswtch *afp)
{
if (setaddr && doalias == 0 && param < 0)
- bcopy((caddr_t)rqtosa(af_addreq),
- (caddr_t)rqtosa(af_ridreq),
- rqtosa(af_addreq)->sa_len);
+ if (afp->af_addreq != NULL && afp->af_ridreq != NULL)
+ bcopy((caddr_t)rqtosa(af_addreq),
+ (caddr_t)rqtosa(af_ridreq),
+ rqtosa(af_addreq)->sa_len);
doalias = param;
if (param < 0) {
clearaddr = 1;