diff options
Diffstat (limited to 'common/dns.c')
-rw-r--r-- | common/dns.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/dns.c b/common/dns.c index 3a60e2de..9fbb879c 100644 --- a/common/dns.c +++ b/common/dns.c @@ -3,7 +3,7 @@ Domain Name Service subroutines. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2001-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -33,7 +33,7 @@ #ifndef lint static char copyright[] = -"$Id: dns.c,v 1.35.2.19 2005/09/07 15:11:00 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dns.c,v 1.35.2.20 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -151,6 +151,7 @@ isc_result_t find_tsig_key (ns_tsig_key **key, const char *zname, nomem: return ISC_R_NOMEMORY; } + memset (tkey, 0, sizeof *tkey); tkey -> data = dmalloc (zone -> key -> key -> len, MDL); if (!tkey -> data) { dfree (tkey, MDL); @@ -215,6 +216,7 @@ isc_result_t dns_zone_lookup (struct dns_zone **zone, const char *name) return ISC_R_NOMEMORY;; strcpy (tname, name); tname [len] = '.'; + tname [len + 1] = 0; name = tname; } if (!dns_zone_hash_lookup (zone, dns_zone_hash, name, 0, MDL)) @@ -418,15 +420,17 @@ void cache_found_zone (ns_class class, if (!zone -> name) { zone -> name = - dmalloc (strlen (zname) + 1 + (ix ? 1 : 0), MDL); + dmalloc (strlen (zname) + 1 + (ix != 0), MDL); if (!zone -> name) { dns_zone_dereference (&zone, MDL); return; } strcpy (zone -> name, zname); /* Add a trailing '.' if it was missing. */ - if (ix) + if (ix) { zone -> name [ix] = '.'; + zone -> name [ix + 1] = 0; + } } /* XXX Need to get the lower-level code to push the actual zone |