From: Ted Lemon Date: Fri, 19 Feb 1999 17:59:56 +0000 (+0000) Subject: Test a potentially null pointer for nullness before dereferencing it. X-Git-Tag: V2-BETA-1-PATCH-14~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dd8cf4bac782f441b62263932b705c8dfb8c0cfa;p=thirdparty%2Fdhcp.git Test a potentially null pointer for nullness before dereferencing it. --- diff --git a/server/dhcp.c b/server/dhcp.c index f768cb8c4..80ddc4bca 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.57.2.16 1999/02/16 19:18:35 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.57.2.17 1999/02/19 17:59:56 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1360,7 +1360,8 @@ struct lease *find_lease (packet, share, ours) lease to be abandoned. If so, this request probably came from that client. */ if (ip_lease && (ip_lease -> shared_network != share)) { - *ours = 1; + if (ours) + *ours = 1; ip_lease = (struct lease *)0; strcpy (dhcp_message, "requested address on bad subnet"); } @@ -1390,7 +1391,8 @@ struct lease *find_lease (packet, share, ours) } strcpy (dhcp_message, "requested address is not available"); ip_lease = (struct lease *)0; - *ours = 1; + if (ours) + *ours = 1; /* If we get to here and fixed_lease is not null, that means that there are both a dynamic lease and a fixed-address