]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Backing out rt15075.
authorDavid Hankins <dhankins@isc.org>
Wed, 15 Feb 2006 23:00:08 +0000 (23:00 +0000)
committerDavid Hankins <dhankins@isc.org>
Wed, 15 Feb 2006 23:00:08 +0000 (23:00 +0000)
28 files changed:
RELNOTES
client/clparse.c
client/dhclient.c
common/alloc.c
common/comapi.c
common/conflex.c
common/discover.c
common/dispatch.c
common/dns.c
common/execute.c
common/options.c
common/parse.c
common/print.c
common/tables.c
common/tree.c
omapip/alloc.c
omapip/array.c
omapip/generic.c
omapip/handle.c
omapip/hash.c
omapip/protocol.c
omapip/support.c
omapip/trace.c
server/confpars.c
server/dhcp.c
server/failover.c
server/omapi.c
server/salloc.c

index 61a867b6eee486c8ba7494bfc574c3205e29d27f..c298419f3b038ae65a1a7d0451c58f5a41a5f3d3 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -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
index e1ad0769542e10a716f1c6a0f737244f15835d88..0ced85c252c75b20c2ee14d73c8c4ea2a0f36524 100644 (file)
@@ -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");
index 54bfc15b8c932fcea5a003616475df36ca877676..1da6840ecd224f4e1bd785691d51c49a08e59809 100644 (file)
@@ -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;
index 375709d2a0dc015d3196b23f9eac596ee35334b1..181f01b9521413ac00f5d32cbb81a97befd6f6ec 100644 (file)
@@ -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;
 }
index f3b74e9f083c672d084d0b24cf692cb52a34a854..ad0eef45ccb0d4629e510cae98fa6914db6b344b 100644 (file)
@@ -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;
index 9b5df396be91f5fdb4713f21c07d19f2c06419e8..54d1f38c535833ab49f03275c7040bcc8303e7e2 100644 (file)
@@ -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);
index fba6c7664974f03979e9fb73120690c6fca9d036..4db60ceae3a4a0adcd3dc6f71fc30a6a2fe8082f 100644 (file)
@@ -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,
index 9addda485b24e886e7ea0e03a9230760faf894d8..26f758a74fa31a26334b45b36d5ead38fbe575e2 100644 (file)
@@ -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;
index 3a60e2de1b25f413947782c78357da47caf77fc1..9fbb879cecc6d650a2246efe65aa63e5bb099895 100644 (file)
@@ -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
index e6b8090b2d663f45d013d89d7f8876ae8f10eac9..101ef134497c213725270039c36f0286391d15b0 100644 (file)
@@ -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);
index 401bcd23b160375256240269d992a219637f285c..68309948b6eb0899369f618e26f9ea7caaf260e9 100644 (file)
@@ -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. */
index 1a42cbcf83df16f85e07cc2351f3ba717a19f379..e8d9f4ed777499dfc9116a90a6bf91732a9061b8 100644 (file)
@@ -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;
                }
index 0e7001f54a9b7e817280377887472ef164979249..4a3e64e5e0c2c10a847a078e347429d60cecf197 100644 (file)
@@ -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);
index 2b20c772fce99e93b7de99c80876dc4eb75c2fb4..681cc525e64b88ebf7318a6a02e3421c94bd9405 100644 (file)
@@ -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";
index 51bda25ee0d811db9982492cba08f19e15445372..0a6a8d02e6a38e60cef42322fcc561bea0362d5f 100644 (file)
@@ -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);
index f3780cb040607fb42b58bde0a8817494a8929d76..4f8e0eca8e60c628aa4545f435f8acbcfa2a8874 100644 (file)
@@ -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);
index f8b3af0ab3c1d02fbc5b3854fd2f5053f6d14a66..695dc34f1d24cc37a8fb817006325ca3116562b9 100644 (file)
@@ -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) {
index 6bc1d70e2b0c9d499f98366e96c0deb32c46f285..2be0a217630bc0af0da9171cf04d25571d928d95 100644 (file)
@@ -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)
index 3c7095084730d68b5ef8737563de92e9bdece326..5c441b5737bd505ef2496333026e96948fe31f35 100644 (file)
@@ -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;
index 3f92acc333a610644215d460d42c6e64b38fdbc3..2ba0af01216841088707a9320d0e5bc15c4337ca 100644 (file)
@@ -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) {
index 76ac5ceebd5b85735cc4275d3ef50eb3ff61e09e..b61b231ea9b141411e730c53a55e6545332a5058 100644 (file)
@@ -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) {
index c1412cc6bf723a103b430bdaa7ad23f4aef2c95e..667db86db38345bad3c2daa2c294ff763124e0c8 100644 (file)
@@ -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;
index 5937c2aa5c5c08bc96aca5198c007ba688755cff..30f4ba592a15017c242c5340f88e5633b16bed96 100644 (file)
@@ -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)
 {
index 1f5524a9e798f65ad1ca463717c8248faca8ac39..f20b956b2ea8fdb04e961bd66076ba3fa973e7c9 100644 (file)
@@ -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);
index 6c3c31515228647ccb15d8721728b4905b85ab65..59b5e825bc4738ea0952f963bc3d6692bdd59812 100644 (file)
@@ -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);
        }
 
index b6bdfd6989034dea8dfc9f7cf8a636348d8d06d7..494b2f16985487e16f6caa79c68afd6d7e62dfe0 100644 (file)
@@ -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;
index bfc83830968414964585077bef12ebdd35d17b05..3961c91b6fe9a29cbe8e60950a42fab436cdf6ee 100644 (file)
@@ -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)
index 603dc2d75793fee1e57c7a55b4bebe1468db0d87..29604f05859336e64c941a2270d9501fb772c3cf 100644 (file)
@@ -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;
 }