Avoid segmentation fault if "dns_zone_lookup()" is called with an empty

string as name. Problem noted by Simon Burge.
This commit is contained in:
tron 2000-11-07 13:21:36 +00:00
parent 975795b27b
commit 68fa36f81f
1 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,7 @@
#ifndef lint
static char copyright[] =
"$Id: dns.c,v 1.2 2000/10/29 22:55:57 tron Exp $ Copyright (c) 2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: dns.c,v 1.3 2000/11/07 13:21:36 tron Exp $ Copyright (c) 2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -220,6 +220,9 @@ isc_result_t dns_zone_lookup (struct dns_zone **zone, const char *name)
return ISC_R_NOTFOUND;
len = strlen (name);
if (len == 0)
return ISC_R_NOTFOUND;
if (name [len - 1] != '.') {
tname = dmalloc (len + 2, MDL);
if (!tname)