diff options
author | David Hankins <dhankins@isc.org> | 2006-02-15 23:00:08 +0000 |
---|---|---|
committer | David Hankins <dhankins@isc.org> | 2006-02-15 23:00:08 +0000 |
commit | def9ee108230307a1eed301bf4a4b4820335d32b (patch) | |
tree | ab111cb7bf5b4a6e4cdbc33f9464f5eefe7a63f2 | |
parent | 2d07c89f495e53f28c3c954b1b97f7d0ae742b47 (diff) | |
download | isc-dhcp-def9ee108230307a1eed301bf4a4b4820335d32b.tar.gz |
Backing out rt15075.
-rw-r--r-- | RELNOTES | 2 | ||||
-rw-r--r-- | client/clparse.c | 8 | ||||
-rw-r--r-- | client/dhclient.c | 11 | ||||
-rw-r--r-- | common/alloc.c | 40 | ||||
-rw-r--r-- | common/comapi.c | 5 | ||||
-rw-r--r-- | common/conflex.c | 8 | ||||
-rw-r--r-- | common/discover.c | 5 | ||||
-rw-r--r-- | common/dispatch.c | 6 | ||||
-rw-r--r-- | common/dns.c | 12 | ||||
-rw-r--r-- | common/execute.c | 6 | ||||
-rw-r--r-- | common/options.c | 5 | ||||
-rw-r--r-- | common/parse.c | 6 | ||||
-rw-r--r-- | common/print.c | 8 | ||||
-rw-r--r-- | common/tables.c | 5 | ||||
-rw-r--r-- | common/tree.c | 7 | ||||
-rw-r--r-- | omapip/alloc.c | 13 | ||||
-rw-r--r-- | omapip/array.c | 6 | ||||
-rw-r--r-- | omapip/generic.c | 8 | ||||
-rw-r--r-- | omapip/handle.c | 13 | ||||
-rw-r--r-- | omapip/hash.c | 7 | ||||
-rw-r--r-- | omapip/protocol.c | 5 | ||||
-rw-r--r-- | omapip/support.c | 5 | ||||
-rw-r--r-- | omapip/trace.c | 8 | ||||
-rw-r--r-- | server/confpars.c | 15 | ||||
-rw-r--r-- | server/dhcp.c | 6 | ||||
-rw-r--r-- | server/failover.c | 5 | ||||
-rw-r--r-- | server/omapi.c | 8 | ||||
-rw-r--r-- | server/salloc.c | 9 |
28 files changed, 170 insertions, 72 deletions
@@ -62,6 +62,8 @@ and for prodding me into improving it. move leases to RESET, and primaries refuse to accept that state transition (properly). +- The memset-after-dmalloc() changes made in 3.0.4b1 have been backed out. + Changes since 3.0.4b1 - Command line parsing in omshell was repaired - it no longer closes diff --git a/client/clparse.c b/client/clparse.c index e1ad0769..0ced85c2 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -3,7 +3,7 @@ Parser for dhclient config and lease files... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: clparse.c,v 1.62.2.10 2005/10/14 15:34:52 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: clparse.c,v 1.62.2.11 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" @@ -128,6 +128,7 @@ isc_result_t read_client_conf () dmalloc (sizeof (struct client_state), MDL); if (!ip -> client) log_fatal ("no memory for client state."); + memset (ip -> client, 0, sizeof *(ip -> client)); ip -> client -> interface = ip; } @@ -665,6 +666,7 @@ void parse_option_list (cfile, list) ix = 0; for (q = p; q; q = q -> cdr) (*list) [ix++] = (u_int32_t)(long)q -> car; + (*list) [ix] = 0; } while (p) { q = p -> cdr; @@ -800,6 +802,7 @@ void make_client_state (state) *state = ((struct client_state *)dmalloc (sizeof **state, MDL)); if (!*state) log_fatal ("no memory for client state\n"); + memset (*state, 0, sizeof **state); } void make_client_config (client, config) @@ -848,6 +851,7 @@ void parse_client_lease_statement (cfile, is_static) dmalloc (sizeof (struct client_lease), MDL)); if (!lease) log_fatal ("no memory for lease.\n"); + memset (lease, 0, sizeof *lease); lease -> is_static = is_static; if (!option_state_allocate (&lease -> options, MDL)) log_fatal ("no memory for lease options.\n"); diff --git a/client/dhclient.c b/client/dhclient.c index 54bfc15b..1da6840e 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -32,7 +32,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.129.2.29 2005/10/10 16:45:38 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.129.2.30 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" @@ -1254,9 +1254,11 @@ struct client_lease *packet_to_lease (packet, client) log_error ("dhcpoffer: no memory for server name.\n"); destroy_client_lease (lease); return (struct client_lease *)0; - } else + } else { memcpy (lease -> server_name, packet -> raw -> sname, len); + lease -> server_name [len] = 0; + } } /* Ditto for the filename. */ @@ -1271,9 +1273,11 @@ struct client_lease *packet_to_lease (packet, client) log_error ("dhcpoffer: no memory for filename.\n"); destroy_client_lease (lease); return (struct client_lease *)0; - } else + } else { memcpy (lease -> filename, packet -> raw -> file, len); + lease -> filename [len] = 0; + } } execute_statements_in_scope ((struct binding_value **)0, @@ -2578,6 +2582,7 @@ int script_go (client) } /* Set $PATH. */ envp [i++] = client_path; + envp [i] = (char *)0; argv [0] = scriptName; argv [1] = (char *)0; diff --git a/common/alloc.c b/common/alloc.c index 375709d2..181f01b9 100644 --- a/common/alloc.c +++ b/common/alloc.c @@ -3,7 +3,7 @@ Memory allocation... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: alloc.c,v 1.53.2.11 2005/08/26 22:45:44 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: alloc.c,v 1.53.2.12 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" @@ -69,8 +69,10 @@ int option_chain_head_allocate (ptr, file, line) } h = dmalloc (sizeof *h, file, line); - if (h) + if (h) { + memset (h, 0, sizeof *h); return option_chain_head_reference (ptr, h, file, line); + } return 0; } @@ -180,8 +182,10 @@ int group_allocate (ptr, file, line) } g = dmalloc (sizeof *g, file, line); - if (g) + if (g) { + memset (g, 0, sizeof *g); return group_reference (ptr, g, file, line); + } return 0; } @@ -315,6 +319,8 @@ struct option *new_option (file, line) { struct option *rval = dmalloc (sizeof (struct option), file, line); + if (rval) + memset (rval, 0, sizeof *rval); return rval; } @@ -407,6 +413,7 @@ pair new_pair (file, line) foo = dmalloc (sizeof *foo, file, line); if (!foo) return foo; + memset (foo, 0, sizeof *foo); return foo; } @@ -447,12 +454,12 @@ int expression_allocate (cptr, file, line) rval = free_expressions; free_expressions = rval -> data.not; dmalloc_reuse (rval, file, line, 1); - memset(rval, 0, sizeof(struct expression)); } else { rval = dmalloc (sizeof (struct expression), file, line); if (!rval) return 0; } + memset (rval, 0, sizeof *rval); return expression_reference (cptr, rval, file, line); } @@ -521,12 +528,12 @@ int binding_value_allocate (cptr, file, line) rval = free_binding_values; free_binding_values = rval -> value.bv; dmalloc_reuse (rval, file, line, 1); - memset(rval, 0, sizeof(struct binding_value)); } else { rval = dmalloc (sizeof (struct binding_value), file, line); if (!rval) return 0; } + memset (rval, 0, sizeof *rval); return binding_value_reference (cptr, rval, file, line); } @@ -592,6 +599,7 @@ int fundef_allocate (cptr, file, line) rval = dmalloc (sizeof (struct fundef), file, line); if (!rval) return 0; + memset (rval, 0, sizeof *rval); return fundef_reference (cptr, rval, file, line); } @@ -651,12 +659,12 @@ int option_cache_allocate (cptr, file, line) free_option_caches = (struct option_cache *)(rval -> expression); dmalloc_reuse (rval, file, line, 0); - memset(rval, 0, sizeof(struct option_cache)); } else { rval = dmalloc (sizeof (struct option_cache), file, line); if (!rval) return 0; } + memset (rval, 0, sizeof *rval); return option_cache_reference (cptr, rval, file, line); } @@ -699,6 +707,8 @@ int buffer_allocate (ptr, len, file, line) bp = dmalloc (len + sizeof *bp, file, line); if (!bp) return 0; + memset (bp, 0, sizeof *bp); + bp -> refcnt = 0; return buffer_reference (ptr, bp, file, line); } @@ -785,6 +795,8 @@ int dns_host_entry_allocate (ptr, hostname, file, line) bp = dmalloc (strlen (hostname) + sizeof *bp, file, line); if (!bp) return 0; + memset (bp, 0, sizeof *bp); + bp -> refcnt = 0; strcpy (bp -> hostname, hostname); return dns_host_entry_reference (ptr, bp, file, line); } @@ -879,6 +891,7 @@ int option_state_allocate (ptr, file, line) size = sizeof **ptr + (universe_count - 1) * sizeof (VOIDPTR); *ptr = dmalloc (size, file, line); if (*ptr) { + memset (*ptr, 0, size); (*ptr) -> universe_count = universe_count; (*ptr) -> refcnt = 1; rc_register (file, line, @@ -972,6 +985,7 @@ int executable_statement_allocate (ptr, file, line) bp = dmalloc (sizeof *bp, file, line); if (!bp) return 0; + memset (bp, 0, sizeof *bp); return executable_statement_reference (ptr, bp, file, line); } @@ -1047,12 +1061,13 @@ int packet_allocate (ptr, file, line) p = free_packets; free_packets = (struct packet *)(p -> raw); dmalloc_reuse (p, file, line, 1); - memset(p, 0, sizeof(struct packet)); } else { - p = dmalloc(sizeof(struct packet), file, line); + p = dmalloc (sizeof *p, file, line); } - if (p) + if (p) { + memset (p, 0, sizeof *p); return packet_reference (ptr, p, file, line); + } return 0; } @@ -1163,8 +1178,10 @@ int dns_zone_allocate (ptr, file, line) } d = dmalloc (sizeof *d, file, line); - if (d) + if (d) { + memset (d, 0, sizeof *d); return dns_zone_reference (ptr, d, file, line); + } return 0; } @@ -1224,6 +1241,7 @@ int binding_scope_allocate (ptr, file, line) bp = dmalloc (sizeof *bp, file, line); if (!bp) return 0; + memset (bp, 0, sizeof *bp); binding_scope_reference (ptr, bp, file, line); return 1; } diff --git a/common/comapi.c b/common/comapi.c index f3b74e9f..ad0eef45 100644 --- a/common/comapi.c +++ b/common/comapi.c @@ -3,7 +3,7 @@ OMAPI object interfaces for the DHCP server. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -41,7 +41,7 @@ #ifndef lint static char copyright[] = -"$Id: comapi.c,v 1.9.2.8 2005/08/26 22:45:44 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: comapi.c,v 1.9.2.9 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" @@ -163,6 +163,7 @@ isc_result_t dhcp_group_set_value (omapi_object_t *h, memcpy (group -> name, value -> u.buffer.value, value -> u.buffer.len); + group -> name [value -> u.buffer.len] = 0; } else return ISC_R_INVALIDARG; return ISC_R_SUCCESS; diff --git a/common/conflex.c b/common/conflex.c index 9b5df396..54d1f38c 100644 --- a/common/conflex.c +++ b/common/conflex.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: conflex.c,v 1.92.2.17 2005/10/14 15:34:52 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: conflex.c,v 1.92.2.18 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" @@ -61,17 +61,23 @@ isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp) tmp = dmalloc (sizeof (struct parse), MDL); if (!tmp) return ISC_R_NOMEMORY; + memset (tmp, 0, sizeof *tmp); + tmp -> token = 0; tmp -> tlname = name; tmp -> lpos = tmp -> line = 1; tmp -> cur_line = tmp -> line1; tmp -> prev_line = tmp -> line2; tmp -> token_line = tmp -> cur_line; + tmp -> cur_line [0] = tmp -> prev_line [0] = 0; + tmp -> warnings_occurred = 0; tmp -> file = file; tmp -> eol_token = eolp; + tmp -> bufix = 0; tmp -> buflen = buflen; if (inbuf) { + tmp -> bufsiz = 0; tmp -> inbuf = inbuf; } else { tmp -> inbuf = dmalloc (8192, MDL); diff --git a/common/discover.c b/common/discover.c index fba6c766..4db60cea 100644 --- a/common/discover.c +++ b/common/discover.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: discover.c,v 1.42.2.19 2005/09/28 18:58:27 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: discover.c,v 1.42.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" @@ -443,6 +443,7 @@ void discover_interfaces (state) MDL); if (!tif) log_fatal ("no space to remember ifp."); + memset (tif, 0, sizeof (struct ifreq)); strcpy (tif -> ifr_name, tmp -> name); tmp -> ifp = tif; } @@ -1126,6 +1127,8 @@ void interface_stash (struct interface_info *tptr) sizeof (struct interface_info *), MDL); if (!vec) return; + memset (&vec [interface_max], 0, + (sizeof (struct interface_info *)) * delta); interface_max += delta; if (interface_vector) { memcpy (vec, interface_vector, diff --git a/common/dispatch.c b/common/dispatch.c index 9addda48..26f758a7 100644 --- a/common/dispatch.c +++ b/common/dispatch.c @@ -3,7 +3,7 @@ Network input dispatcher... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: dispatch.c,v 1.63.2.6 2005/10/10 16:45:39 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dispatch.c,v 1.63.2.7 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" @@ -126,13 +126,13 @@ void add_timeout (when, where, what, ref, unref) if (free_timeouts) { q = free_timeouts; free_timeouts = q -> next; - memset(q, 0, sizeof(struct timeout)); } else { q = ((struct timeout *) dmalloc (sizeof (struct timeout), MDL)); if (!q) log_fatal ("add_timeout: no memory!"); } + memset (q, 0, sizeof *q); q -> func = where; q -> ref = ref; q -> unref = unref; 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 diff --git a/common/execute.c b/common/execute.c index e6b8090b..101ef134 100644 --- a/common/execute.c +++ b/common/execute.c @@ -3,7 +3,7 @@ Support for executable statements. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1998-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: execute.c,v 1.44.2.13 2005/08/26 22:45:45 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: execute.c,v 1.44.2.14 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" @@ -272,6 +272,7 @@ int execute_statements (result, packet, lease, client_state, if (!binding) { binding = dmalloc (sizeof *binding, MDL); if (binding) { + memset (binding, 0, sizeof *binding); binding -> name = dmalloc (strlen (r -> data.set.name) + 1, @@ -351,6 +352,7 @@ int execute_statements (result, packet, lease, client_state, next_let: if (ns) { binding = dmalloc (sizeof *binding, MDL); + memset (binding, 0, sizeof *binding); if (!binding) { blb: binding_scope_dereference (&ns, MDL); diff --git a/common/options.c b/common/options.c index 401bcd23..68309948 100644 --- a/common/options.c +++ b/common/options.c @@ -3,7 +3,7 @@ DHCP options parsing and reassembly. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: options.c,v 1.85.2.32 2005/11/01 23:19:03 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: options.c,v 1.85.2.33 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #define DHCP_OPTION_DATA @@ -1718,6 +1718,7 @@ void save_hashed_option (universe, options, oc) universe -> name, oc -> option -> name); return; } + memset (hash, 0, OPTION_HASH_SIZE * sizeof *hash); options -> universes [universe -> index] = (VOIDPTR)hash; } else { /* Try to find an existing option matching the new one. */ diff --git a/common/parse.c b/common/parse.c index 1a42cbcf..e8d9f4ed 100644 --- a/common/parse.c +++ b/common/parse.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: parse.c,v 1.104.2.25 2005/10/10 16:45:39 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: parse.c,v 1.104.2.26 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" @@ -1261,6 +1261,7 @@ int parse_option_code_definition (cfile, option) tokix += has_encapsulation; if (arrayp) s [tokix++] = (arrayp > recordp) ? 'a' : 'A'; + s [tokix] = 0; option -> format = s; if (option -> universe -> options [option -> code]) { /* XXX Free the option, but we can't do that now because they @@ -1314,6 +1315,7 @@ int parse_base64 (data, cfile) t = dmalloc (l + sizeof *t, MDL); if (!t) log_fatal ("no memory for base64 buffer."); + memset (t, 0, (sizeof *t) - 1); memcpy (t -> string, val, l + 1); cc += l; if (last) @@ -1728,6 +1730,7 @@ int parse_executable_statement (result, cfile, lose, case_context) strlen (val), MDL)); if (!new) log_fatal ("can't allocate string."); + memset (new, 0, sizeof *new); strcpy (new -> string, val); if (cur) { cur -> next = new; @@ -1972,6 +1975,7 @@ int parse_executable_statement (result, cfile, lose, case_context) } strcpy (s, zone -> name); s [i] = '.'; + s [i + 1] = 0; dfree (zone -> name, MDL); zone -> name = s; } diff --git a/common/print.c b/common/print.c index 0e7001f5..4a3e64e5 100644 --- a/common/print.c +++ b/common/print.c @@ -3,7 +3,7 @@ Turn data structures into printable text. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: print.c,v 1.53.2.12 2005/08/26 22:45:46 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: print.c,v 1.53.2.13 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" @@ -72,6 +72,7 @@ char *quotify_string (const char *s, const char *file, int line) } else *nsp++ = *sp; } + *nsp++ = 0; } return buf; } @@ -109,6 +110,7 @@ char *quotify_buf (const unsigned char *s, unsigned len, } else *nsp++ = s [i]; } + *nsp++ = 0; } return buf; } @@ -157,6 +159,7 @@ char *print_base64 (const unsigned char *buf, unsigned len, } if (!len) *s++ = '='; + *s++ = 0; if (s > b + bl + 1) abort (); return b; @@ -1094,6 +1097,7 @@ int token_indent_data_string (FILE *file, int col, int indent, buf [0] = '"'; memcpy (buf + 1, data -> data, data -> len); buf [data -> len + 1] = '"'; + buf [data -> len + 2] = 0; i = token_print_indent (file, col, indent, prefix, suffix, buf); dfree (buf, MDL); diff --git a/common/tables.c b/common/tables.c index 2b20c772..681cc525 100644 --- a/common/tables.c +++ b/common/tables.c @@ -3,7 +3,7 @@ Tables of information... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: tables.c,v 1.51.2.11 2005/11/01 23:19:03 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: tables.c,v 1.51.2.12 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" @@ -1148,6 +1148,7 @@ void initialize_common_option_spaces() dmalloc (universe_max * sizeof (struct universe *), MDL)); if (!universes) log_fatal ("Can't allocate option space table."); + memset (universes, 0, universe_max * sizeof (struct universe *)); /* Set up the DHCP option universe... */ dhcp_universe.name = "dhcp"; diff --git a/common/tree.c b/common/tree.c index 51bda25e..0a6a8d02 100644 --- a/common/tree.c +++ b/common/tree.c @@ -3,7 +3,7 @@ Routines for manipulating parse trees... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: tree.c,v 1.101.2.12 2005/08/26 22:45:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: tree.c,v 1.101.2.13 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" @@ -491,6 +491,7 @@ int evaluate_expression (result, packet, lease, client_state, binding_scope_dereference (&ns, MDL); return 0; } else { + memset (nb, 0, sizeof *nb); nb -> name = dmalloc (strlen (s -> string) + 1, MDL); if (nb -> name) @@ -694,6 +695,7 @@ int evaluate_dns_expression (result, packet, lease, client_state, in_options, data_string_forget (&name, MDL); } else { memcpy (tname, name.data, name.len); + tname [name.len] = 0; memset (&data, 0, sizeof data); r2 = evaluate_data_expression (&data, packet, lease, client_state, @@ -4011,6 +4013,7 @@ struct binding *create_binding (struct binding_scope **scope, const char *name) if (!binding) return (struct binding *)0; + memset (binding, 0, sizeof *binding); binding -> name = dmalloc (strlen (name) + 1, MDL); if (!binding -> name) { dfree (binding, MDL); diff --git a/omapip/alloc.c b/omapip/alloc.c index f3780cb0..4f8e0eca 100644 --- a/omapip/alloc.c +++ b/omapip/alloc.c @@ -4,7 +4,7 @@ protocol... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -35,7 +35,7 @@ #ifndef lint static char copyright[] = -"$Id: alloc.c,v 1.22.2.11 2005/08/26 22:45:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium, Inc. All rights reserved.\n"; +"$Id: alloc.c,v 1.22.2.12 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium, Inc. All rights reserved.\n"; #endif /* not lint */ #include <omapip/omapip_p.h> @@ -561,9 +561,6 @@ isc_result_t omapi_object_initialize (omapi_object_t *o, size_t usize, size_t psize, const char *file, int line) { - /* We don't know if we got this buffer from dmalloc() or an allocator - * that might not initialize the buffer. This memset() is required. - */ memset (o, 0, psize); o -> type = type; if (type -> initialize) @@ -729,6 +726,7 @@ isc_result_t omapi_buffer_new (omapi_buffer_t **h, t = (omapi_buffer_t *)dmalloc (sizeof *t, file, line); if (!t) return ISC_R_NOMEMORY; + memset (t, 0, sizeof *t); status = omapi_buffer_reference (h, t, file, line); if (status != ISC_R_SUCCESS) dfree (t, file, line); @@ -845,6 +843,7 @@ isc_result_t omapi_typed_data_new (const char *file, int line, new = dmalloc (len, file, line); if (!new) return ISC_R_NOMEMORY; + memset (new, 0, len); switch (type) { case omapi_datatype_int: @@ -953,6 +952,7 @@ isc_result_t omapi_data_string_new (omapi_data_string_t **d, unsigned len, new = dmalloc (nlen, file, line); if (!new) return ISC_R_NOMEMORY; + memset (new, 0, OMAPI_DATA_STRING_EMPTY_SIZE); new -> len = len; return omapi_data_string_reference (d, new, file, line); } @@ -1024,6 +1024,7 @@ isc_result_t omapi_value_new (omapi_value_t **d, new = dmalloc (sizeof *new, file, line); if (!new) return ISC_R_NOMEMORY; + memset (new, 0, sizeof *new); return omapi_value_reference (d, new, file, line); } @@ -1102,6 +1103,8 @@ isc_result_t omapi_addr_list_new (omapi_addr_list_t **d, unsigned count, sizeof (omapi_addr_list_t), file, line); if (!new) return ISC_R_NOMEMORY; + memset (new, 0, ((count * sizeof (omapi_addr_t)) + + sizeof (omapi_addr_list_t))); new -> count = count; new -> addresses = (omapi_addr_t *)(new + 1); return omapi_addr_list_reference (d, new, file, line); diff --git a/omapip/array.c b/omapip/array.c index f8b3af0a..695dc34f 100644 --- a/omapip/array.c +++ b/omapip/array.c @@ -3,7 +3,7 @@ Subroutines that support the omapi extensible array type. */ /* - * 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 @@ -34,7 +34,7 @@ #ifndef lint static char ocopyright[] = -"$Id: array.c,v 1.1.2.3 2005/08/26 22:45:47 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; +"$Id: array.c,v 1.1.2.4 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; #endif #include <omapip/omapip_p.h> @@ -117,6 +117,8 @@ isc_result_t omapi_array_set (omapi_array_t *array, void *ptr, int index, file, line); if (!newbuf) return ISC_R_NOMEMORY; + /* Zero the new elements. */ + memset (&newbuf [array -> max], 0, (sizeof (char *)) * delta); array -> max += delta; /* Copy the old array data into the new buffer. */ if (array -> data) { diff --git a/omapip/generic.c b/omapip/generic.c index 6bc1d70e..2be0a217 100644 --- a/omapip/generic.c +++ b/omapip/generic.c @@ -3,7 +3,7 @@ Subroutines that support the generic object. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char ocopyright[] = -"$Id: generic.c,v 1.9.2.5 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; +"$Id: generic.c,v 1.9.2.6 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; #endif #include <omapip/omapip_p.h> @@ -144,6 +144,10 @@ isc_result_t omapi_generic_set_value (omapi_object_t *h, memcpy (ca, g -> changed, g -> va_max * sizeof *ca); } + memset (va + g -> va_max, 0, + (vm_new - g -> va_max) * sizeof *va); + memset (ca + g -> va_max, 0, + (vm_new - g -> va_max) * sizeof *ca); if (g -> values) dfree (g -> values, MDL); if (g -> changed) diff --git a/omapip/handle.c b/omapip/handle.c index 3c709508..5c441b57 100644 --- a/omapip/handle.c +++ b/omapip/handle.c @@ -3,7 +3,7 @@ Functions for maintaining handles on objects. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char ocopyright[] = -"$Id: handle.c,v 1.6.2.2 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; +"$Id: handle.c,v 1.6.2.3 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; #endif #include <omapip/omapip_p.h> @@ -88,6 +88,8 @@ isc_result_t omapi_object_handle (omapi_handle_t *h, omapi_object_t *o) omapi_handle_table = dmalloc (sizeof *omapi_handle_table, MDL); if (!omapi_handle_table) return ISC_R_NOMEMORY; + memset (omapi_handle_table, 0, sizeof *omapi_handle_table); + omapi_handle_table -> first = 0; omapi_handle_table -> limit = OMAPI_HANDLE_TABLE_SIZE; omapi_handle_table -> leafp = 1; } @@ -104,8 +106,11 @@ isc_result_t omapi_object_handle (omapi_handle_t *h, omapi_object_t *o) new = dmalloc (sizeof *new, MDL); if (!new) return ISC_R_NOMEMORY; + memset (new, 0, sizeof *new); + new -> first = 0; new -> limit = (omapi_handle_table -> limit * OMAPI_HANDLE_TABLE_SIZE); + new -> leafp = 0; new -> children [0].table = omapi_handle_table; omapi_handle_table = new; } @@ -176,6 +181,7 @@ static isc_result_t omapi_object_handle_in_table (omapi_handle_t h, inner = dmalloc (sizeof *inner, MDL); if (!inner) return ISC_R_NOMEMORY; + memset (inner, 0, sizeof *inner); inner -> first = index * scale + table -> first; inner -> limit = inner -> first + scale; if (scale == OMAPI_HANDLE_TABLE_SIZE) @@ -225,8 +231,11 @@ static isc_result_t omapi_handle_table_enclose (omapi_handle_table_t **table) new = dmalloc (sizeof *new, MDL); if (!new) return ISC_R_NOMEMORY; + memset (new, 0, sizeof *new); new -> first = base; new -> limit = base + scale; + if (scale == OMAPI_HANDLE_TABLE_SIZE) + new -> leafp = 0; new -> children [index].table = inner; *table = new; return ISC_R_SUCCESS; diff --git a/omapip/hash.c b/omapip/hash.c index 3f92acc3..2ba0af01 100644 --- a/omapip/hash.c +++ b/omapip/hash.c @@ -3,7 +3,7 @@ Routines for manipulating hash tables... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: hash.c,v 1.1.2.7 2005/08/26 22:45:48 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: hash.c,v 1.1.2.8 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include <omapip/omapip_p.h> @@ -155,6 +155,7 @@ struct hash_bucket *new_hash_bucket (file, line) # if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) rval -> next = hash_bucket_hunks; hash_bucket_hunks = rval; + hash_bucket_hunks -> len = 0; i++; rval++; #endif @@ -194,6 +195,8 @@ int new_hash (struct hash_table **rp, { if (!new_hash_table (rp, DEFAULT_HASH_SIZE, file, line)) return 0; + memset (&(*rp) -> buckets [0], 0, + DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *)); (*rp) -> referencer = referencer; (*rp) -> dereferencer = dereferencer; if (casep) { diff --git a/omapip/protocol.c b/omapip/protocol.c index 76ac5cee..b61b231e 100644 --- a/omapip/protocol.c +++ b/omapip/protocol.c @@ -3,7 +3,7 @@ Functions supporting the object management protocol... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char ocopyright[] = -"$Id: protocol.c,v 1.25.2.9 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; +"$Id: protocol.c,v 1.25.2.10 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; #endif #include <omapip/omapip_p.h> @@ -88,6 +88,7 @@ isc_result_t omapi_protocol_connect (omapi_object_t *h, return ISC_R_NOMEMORY; } + obj -> default_auth -> next = (omapi_remote_auth_t *)0; status = omapi_object_reference (&obj -> default_auth -> a, a, MDL); if (status != ISC_R_SUCCESS) { diff --git a/omapip/support.c b/omapip/support.c index c1412cc6..667db86d 100644 --- a/omapip/support.c +++ b/omapip/support.c @@ -3,7 +3,7 @@ Subroutines providing general support for objects. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char ocopyright[] = -"$Id: support.c,v 1.24.2.5 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; +"$Id: support.c,v 1.24.2.6 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; #endif #include <omapip/omapip_p.h> @@ -253,6 +253,7 @@ isc_result_t omapi_object_type_register (omapi_object_type_t **type, t = dmalloc (sizeof *t, MDL); if (!t) return ISC_R_NOMEMORY; + memset (t, 0, sizeof *t); t -> name = name; t -> set_value = set_value; diff --git a/omapip/trace.c b/omapip/trace.c index 5937c2aa..30f4ba59 100644 --- a/omapip/trace.c +++ b/omapip/trace.c @@ -5,7 +5,7 @@ transactions... */ /* - * 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 @@ -34,7 +34,7 @@ #ifndef lint static char ocopyright[] = -"$Id: trace.c,v 1.9.2.6 2005/10/10 16:48:03 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; +"$Id: trace.c,v 1.9.2.7 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium."; #endif #include <omapip/omapip_p.h> @@ -290,6 +290,8 @@ void trace_type_stash (trace_type_t *tptr) sizeof (trace_type_t *)), MDL); if (!vec) return; + memset (&vec [trace_type_max], 0, + (sizeof (trace_type_t *)) * delta); trace_type_max += delta; if (trace_types) { memcpy (vec, trace_types, @@ -341,7 +343,7 @@ trace_type_t *trace_type_register (const char *name, return ttmp; } - + static isc_result_t trace_type_record (trace_type_t *ttmp, unsigned slen, const char *file, int line) { diff --git a/server/confpars.c b/server/confpars.c index 1f5524a9..f20b956b 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -3,7 +3,7 @@ Parser for dhcpd config file... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1995-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.143.2.28 2005/10/14 15:34:52 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.143.2.29 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" @@ -1930,6 +1930,9 @@ int parse_class_declaration (cp, cfile, group, type) sizeof (struct lease *), MDL); if (!class -> billed_leases) log_fatal ("no memory for billing"); + memset (class -> billed_leases, 0, + (class -> lease_limit * + sizeof class -> billed_leases)); } data_string_copy (&class -> hash_string, &data, MDL); if (!pc -> hash && @@ -2096,6 +2099,9 @@ int parse_class_declaration (cp, cfile, group, type) sizeof (struct lease *), MDL); if (!class -> billed_leases) log_fatal ("no memory for billed leases."); + memset (class -> billed_leases, 0, + (class -> lease_limit * + sizeof class -> billed_leases)); have_billing_classes = 1; parse_semi (cfile); } else { @@ -2365,7 +2371,7 @@ void parse_group_declaration (cfile, group) if (!name) log_fatal ("no memory for group decl name %s", val); strcpy (name, val); - } + } if (!parse_lbrace (cfile)) { group_dereference (&g, MDL); @@ -2915,6 +2921,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile) if (!binding) log_fatal ("No memory for lease %s.", "binding"); + memset (binding, 0, sizeof *binding); binding -> name = dmalloc (strlen (val) + 1, MDL); if (!binding -> name) @@ -2922,7 +2929,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile) "name"); strcpy (binding -> name, val); newbinding = 1; - } else { + } else { if (binding -> value) binding_value_dereference (&binding -> value, MDL); diff --git a/server/dhcp.c b/server/dhcp.c index 6c3c3151..59b5e825 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.192.2.59 2006/01/06 22:09:23 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.192.2.60 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" @@ -2244,8 +2244,10 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) lt -> client_hostname = dmalloc (d1.len + 1, MDL); if (!lt -> client_hostname) log_error ("no memory for client hostname."); - else + else { memcpy (lt -> client_hostname, d1.data, d1.len); + lt -> client_hostname [d1.len] = 0; + } data_string_forget (&d1, MDL); } diff --git a/server/failover.c b/server/failover.c index b6bdfd69..494b2f16 100644 --- a/server/failover.c +++ b/server/failover.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: failover.c,v 1.53.2.43 2005/10/10 16:56:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: failover.c,v 1.53.2.44 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" @@ -405,11 +405,12 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h, XXX or will disconnect blow it away? */ return ISC_R_UNEXPECTED; } + memset (link -> imsg, 0, sizeof (failover_message_t)); link -> imsg -> refcnt = 1; /* Get the length: */ omapi_connection_get_uint16 (c, &link -> imsg_len); link -> imsg_count = 0; /* Bytes read. */ - + /* Maximum of 2048 bytes in any failover message. */ if (link -> imsg_len > DHCP_FAILOVER_MAX_MESSAGE_SIZE) { status = ISC_R_UNEXPECTED; diff --git a/server/omapi.c b/server/omapi.c index bfc83830..3961c91b 100644 --- a/server/omapi.c +++ b/server/omapi.c @@ -3,7 +3,7 @@ OMAPI object interfaces for the DHCP server. */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -41,7 +41,7 @@ #ifndef lint static char copyright[] = -"$Id: omapi.c,v 1.46.2.22 2005/10/07 15:33:57 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: omapi.c,v 1.46.2.23 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" @@ -898,6 +898,7 @@ isc_result_t dhcp_host_set_value (omapi_object_t *h, memcpy (host -> name, value -> u.buffer.value, value -> u.buffer.len); + host -> name [value -> u.buffer.len] = 0; } else return ISC_R_INVALIDARG; return ISC_R_SUCCESS; @@ -2043,6 +2044,7 @@ isc_result_t binding_scope_set_value (struct binding_scope *scope, int createp, if (!nname) return ISC_R_NOMEMORY; memcpy (nname, name -> value, name -> len); + nname [name -> len] = 0; bp = find_binding (scope, nname); if (!bp && !createp) { dfree (nname, MDL); @@ -2093,6 +2095,7 @@ isc_result_t binding_scope_set_value (struct binding_scope *scope, int createp, dfree (nname, MDL); return ISC_R_NOMEMORY; } + memset (bp, 0, sizeof *bp); bp -> name = nname; nname = (char *)0; bp -> next = scope -> bindings; @@ -2119,6 +2122,7 @@ isc_result_t binding_scope_get_value (omapi_value_t **value, if (!nname) return ISC_R_NOMEMORY; memcpy (nname, name -> value, name -> len); + nname [name -> len] = 0; bp = find_binding (scope, nname); dfree (nname, MDL); if (!bp) diff --git a/server/salloc.c b/server/salloc.c index 603dc2d7..29604f05 100644 --- a/server/salloc.c +++ b/server/salloc.c @@ -3,7 +3,7 @@ Memory allocation for the DHCP server... */ /* - * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996-2003 by Internet Software Consortium * * Permission to use, copy, modify, and distribute this software for any @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: salloc.c,v 1.2.2.6 2005/08/26 22:45:51 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n"; +"$Id: salloc.c,v 1.2.2.7 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" @@ -97,6 +97,7 @@ struct lease *new_leases (n, file, line) struct lease *rval; #if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) rval = dmalloc ((n + 1) * sizeof (struct lease), file, line); + memset (rval, 0, sizeof (struct lease)); rval -> starts = n; rval -> next = lease_hunks; lease_hunks = rval; @@ -186,13 +187,12 @@ struct lease_state *new_lease_state (file, line) free_lease_states = (struct lease_state *)(free_lease_states -> next); dmalloc_reuse (rval, file, line, 0); - memset(rval, 0, sizeof(struct lease_state)); } else { rval = dmalloc (sizeof (struct lease_state), file, line); if (!rval) return rval; } - + memset (rval, 0, sizeof *rval); if (!option_state_allocate (&rval -> options, file, line)) { free_lease_state (rval, file, line); return (struct lease_state *)0; @@ -243,6 +243,7 @@ struct permit *new_permit (file, line) dmalloc (sizeof (struct permit), file, line)); if (!permit) return permit; + memset (permit, 0, sizeof *permit); return permit; } |