From aa9a43ea13512e215a6e90616fa9cc3fa0ecff37 Mon Sep 17 00:00:00 2001 From: Phil Blundell Date: Fri, 13 Apr 2001 18:16:53 +0000 Subject: [PATCH] Check that ap->input is non NULL before dereferencing it. --- ifconfig.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ifconfig.c b/ifconfig.c index 0c6ce08..0deba7d 100644 --- a/ifconfig.c +++ b/ifconfig.c @@ -3,7 +3,7 @@ * that either displays or sets the characteristics of * one or more of the system's networking interfaces. * - * Version: $Id: ifconfig.c,v 1.47 2001/04/08 17:05:05 pb Exp $ + * Version: $Id: ifconfig.c,v 1.48 2001/04/13 18:16:53 pb Exp $ * * Author: Fred N. van Kempen, * and others. Copyright 1993 MicroWalt Corporation @@ -919,9 +919,14 @@ int main(int argc, char **argv) break; } } + if (ap->input == NULL) { + fprintf(stderr, _("ifconfig: Cannot set address for this protocol family.\n")); + exit(1); + } if (ap->input(0, host, &sa) < 0) { ap->herror(host); fprintf(stderr, _("ifconfig: `--help' gives usage information.\n")); + exit(1); } memcpy((char *) &ifr.ifr_addr, (char *) &sa, sizeof(struct sockaddr)); { @@ -957,6 +962,7 @@ int main(int argc, char **argv) goterr = 1; } } + /* * Don't do the set_flag() if the address is an alias with a - at the * end, since it's deleted already! - Roman @@ -979,12 +985,14 @@ int main(int argc, char **argv) return (goterr); } + struct ifcmd { int flag; unsigned long addr; char *base; int baselen; }; + static unsigned char searcher[256]; static int set_ip_using(const char *name, int c, unsigned long ip) -- 2.7.4