]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Pulling up rt15075 after review by sra. dmalloc() sets the region
authorDavid Hankins <dhankins@isc.org>
Fri, 26 Aug 2005 22:45:51 +0000 (22:45 +0000)
committerDavid Hankins <dhankins@isc.org>
Fri, 26 Aug 2005 22:45:51 +0000 (22:45 +0000)
allocated to zero.  Memsetting (or etc) such regions to zero is not
useful.

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 5242db580ffe863cdf5157f2a4231c36e4662eff..20665fa232b128c52f624580af036867b5790370 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -68,6 +68,10 @@ and for prodding me into improving it.
 
 - Added some sanity checks to OMAPI connection/authentication code.
 
+- dmalloc() memset()'s the non-debug (data) portion of the allocated
+  memory to zero.  Code that memset()'s the result returned by dmalloc() to
+  zero is redundant.  These redundancies were removed.
+
                        Changes since 3.0.3b3
 
 - dhclient.conf documentation for interface {} was updated to reflect recent
index e5079a1aaacb1cd11815b67110bc38dd9fd7ef39..98744e31e6f46791546fda287ab3d31a77f8023a 100644 (file)
@@ -3,7 +3,7 @@
    Parser for dhclient config and lease files... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.7 2004/11/24 17:39:14 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.62.2.8 2005/08/26 22:45:43 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -128,7 +128,6 @@ 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;
                }
 
@@ -668,7 +667,6 @@ 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;
@@ -798,7 +796,6 @@ 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)
@@ -847,7 +844,6 @@ 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 22e80d8e05b14fc621a559500267abcda28f2da6..dcf65b56b1cb1969a5de46690c61525731986e9b 100644 (file)
@@ -32,7 +32,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.129.2.27 2005/03/03 16:55:22 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.129.2.28 2005/08/26 22:45:43 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1256,11 +1256,9 @@ 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. */
@@ -1275,11 +1273,9 @@ 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,
@@ -2589,7 +2585,6 @@ int script_go (client)
        }
        /* Set $PATH. */
        envp [i++] = client_path;
-       envp [i] = (char *)0;
 
        argv [0] = scriptName;
        argv [1] = (char *)0;
index 39edd810ce83a7c39bf24340cc42266a4d052470..375709d2a0dc015d3196b23f9eac596ee35334b1 100644 (file)
@@ -3,7 +3,7 @@
    Memory allocation... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.10 2004/06/10 17:59:14 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -69,10 +69,8 @@ int option_chain_head_allocate (ptr, file, line)
        }
 
        h = dmalloc (sizeof *h, file, line);
-       if (h) {
-               memset (h, 0, sizeof *h);
+       if (h)
                return option_chain_head_reference (ptr, h, file, line);
-       }
        return 0;
 }
 
@@ -182,10 +180,8 @@ int group_allocate (ptr, file, line)
        }
 
        g = dmalloc (sizeof *g, file, line);
-       if (g) {
-               memset (g, 0, sizeof *g);
+       if (g)
                return group_reference (ptr, g, file, line);
-       }
        return 0;
 }
 
@@ -319,8 +315,6 @@ struct option *new_option (file, line)
 {
        struct option *rval =
                dmalloc (sizeof (struct option), file, line);
-       if (rval)
-               memset (rval, 0, sizeof *rval);
        return rval;
 }
 
@@ -413,7 +407,6 @@ pair new_pair (file, line)
        foo = dmalloc (sizeof *foo, file, line);
        if (!foo)
                return foo;
-       memset (foo, 0, sizeof *foo);
        return foo;
 }
 
@@ -454,12 +447,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);
 }
 
@@ -528,12 +521,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);
 }
 
@@ -599,7 +592,6 @@ 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);
 }
 
@@ -659,12 +651,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);
 }
 
@@ -707,8 +699,6 @@ 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);
 }
 
@@ -795,8 +785,6 @@ 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);
 }
@@ -891,7 +879,6 @@ 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,
@@ -985,7 +972,6 @@ 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);
 }
 
@@ -1061,13 +1047,12 @@ 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 *p, file, line);
+               p = dmalloc(sizeof(struct packet), file, line);
        }
-       if (p) {
-               memset (p, 0, sizeof *p);
+       if (p)
                return packet_reference (ptr, p, file, line);
-       }
        return 0;
 }
 
@@ -1178,10 +1163,8 @@ int dns_zone_allocate (ptr, file, line)
        }
 
        d = dmalloc (sizeof *d, file, line);
-       if (d) {
-               memset (d, 0, sizeof *d);
+       if (d)
                return dns_zone_reference (ptr, d, file, line);
-       }
        return 0;
 }
 
@@ -1241,7 +1224,6 @@ 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 9f0b965d88a57208460de5b0f411d02c3e6d9781..f3b74e9f083c672d084d0b24cf692cb52a34a854 100644 (file)
@@ -3,7 +3,7 @@
    OMAPI object interfaces for the DHCP server. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.7 2004/06/10 17:59:14 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -163,7 +163,6 @@ 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 20b940a7a026ac1b665b1cc60f7af0e5d0f0ff23..a6a7274c9891880a02fe855a1626e0ff96336e6e 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: conflex.c,v 1.92.2.13 2005/03/03 16:55:22 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: conflex.c,v 1.92.2.14 2005/08/26 22:45:44 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -61,23 +61,17 @@ 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 7e3075fcb22b027bcd091c17f7c5437853ac7e69..a94877ef24893500ff7d27d0cd5b48a8151f7ebd 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: discover.c,v 1.42.2.17 2005/03/03 16:55:22 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: discover.c,v 1.42.2.18 2005/08/26 22:45:45 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -443,7 +443,6 @@ 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;
                }
@@ -1115,8 +1114,6 @@ 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 01865ddadc1cc4e7a80e0951ec9fc08d18cc8db4..5b6c19aea9491c4ef5c97d467fb00c1e73880b00 100644 (file)
@@ -3,7 +3,7 @@
    Network input dispatcher... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.4 2004/06/10 17:59:16 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dispatch.c,v 1.63.2.5 2005/08/26 22:45:45 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 90008797191eff93164cee859cc56c5658d9451d..9c33c33447acb6043662e5bbb3a01286c3371093 100644 (file)
@@ -33,7 +33,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dns.c,v 1.35.2.17 2005/08/02 09:04:45 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dns.c,v 1.35.2.18 2005/08/26 22:45:45 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -151,7 +151,6 @@ 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);
@@ -216,7 +215,6 @@ 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))
@@ -420,17 +418,15 @@ void cache_found_zone (ns_class class,
 
        if (!zone -> name) {
                zone -> name =
-                       dmalloc (strlen (zname) + 1 + (ix != 0), MDL);
+                       dmalloc (strlen (zname) + 1 + (ix ? 1 : 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 39653309e9de3e88951937c4e1bbec537b390c33..e6b8090b2d663f45d013d89d7f8876ae8f10eac9 100644 (file)
@@ -3,7 +3,7 @@
    Support for executable statements. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.12 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -272,7 +272,6 @@ 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,
@@ -352,7 +351,6 @@ 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 d0d5caccca0d5386bd5dd632de2f86922b06e0be..7c4cdf20e2949617c1440460e19cfec50cd5d561 100644 (file)
@@ -3,7 +3,7 @@
    DHCP options parsing and reassembly. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.27 2004/12/04 00:03:18 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.85.2.28 2005/08/26 22:45:46 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -1538,7 +1538,6 @@ 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 fc17edb93f509dcbfd76c707ac0cecfd43962308..64537c3989a3e60a4949eff30182a50112845365 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: parse.c,v 1.104.2.23 2005/03/03 16:55:23 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: parse.c,v 1.104.2.24 2005/08/26 22:45:46 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1260,7 +1260,6 @@ 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,7 +1313,6 @@ 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)
@@ -1729,7 +1727,6 @@ 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;
@@ -1974,7 +1971,6 @@ 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 dba117038f92d385741d68399a4f8c965569e867..0e7001f54a9b7e817280377887472ef164979249 100644 (file)
@@ -3,7 +3,7 @@
    Turn data structures into printable text. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.11 2004/06/17 20:54:39 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -72,7 +72,6 @@ char *quotify_string (const char *s, const char *file, int line)
                        } else
                                *nsp++ = *sp;
                }
-               *nsp++ = 0;
        }
        return buf;
 }
@@ -110,7 +109,6 @@ char *quotify_buf (const unsigned char *s, unsigned len,
                        } else
                                *nsp++ = s [i];
                }
-               *nsp++ = 0;
        }
        return buf;
 }
@@ -159,7 +157,6 @@ char *print_base64 (const unsigned char *buf, unsigned len,
        }
        if (!len)
                *s++ = '=';
-       *s++ = 0;
        if (s > b + bl + 1)
                abort ();
        return b;
@@ -1097,7 +1094,6 @@ 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 8c4529f84a066b861c71d1079150efbfa32c3570..204ed840c4ab6dadab28e9a8c52718cb5e82a41d 100644 (file)
@@ -3,7 +3,7 @@
    Tables of information... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.9 2004/09/01 17:06:35 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: tables.c,v 1.51.2.10 2005/08/26 22:45:46 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1145,7 +1145,6 @@ 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 f44bffe5aa741ca08b3cc233cf4768fcc754250e..51bda25ee0d811db9982492cba08f19e15445372 100644 (file)
@@ -3,7 +3,7 @@
    Routines for manipulating parse trees... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.11 2004/11/24 17:39:16 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -491,7 +491,6 @@ 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)
@@ -695,7 +694,6 @@ 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,
@@ -4013,7 +4011,6 @@ 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 5e0127b55fd3dc7a064549eebd2ac42853e1e32a..f3780cb040607fb42b58bde0a8817494a8929d76 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: alloc.c,v 1.22.2.10 2005/08/11 23:12:40 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium, Inc.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include <omapip/omapip_p.h>
@@ -561,6 +561,9 @@ 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)
@@ -726,7 +729,6 @@ 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);
@@ -843,7 +845,6 @@ 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:
@@ -952,7 +953,6 @@ 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,7 +1024,6 @@ 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);
 }
 
@@ -1103,8 +1102,6 @@ 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 ac92afc1ced339e65f2a6c983bb62a8b3fc723da..f8b3af0ab3c1d02fbc5b3854fd2f5053f6d14a66 100644 (file)
@@ -3,7 +3,7 @@
    Subroutines that support the omapi extensible array type. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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
  * ``http://www.nominum.com''.
  */
 
+#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.";
+#endif
+
 #include <omapip/omapip_p.h>
 
 /* Allocate a new extensible array. */
@@ -112,8 +117,6 @@ 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 8b9446f97e9f932ab7a6446e73ad5219ad5aac57..6bc1d70e2b0c9d499f98366e96c0deb32c46f285 100644 (file)
@@ -3,7 +3,7 @@
    Subroutines that support the generic object. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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
  * ``http://www.nominum.com''.
  */
 
+#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.";
+#endif
+
 #include <omapip/omapip_p.h>
 
 OMAPI_OBJECT_ALLOC (omapi_generic,
@@ -139,10 +144,6 @@ 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 cffa4d6094811ed2c0b0cc6b23a394a6d30fba9c..3c7095084730d68b5ef8737563de92e9bdece326 100644 (file)
@@ -3,7 +3,7 @@
    Functions for maintaining handles on objects. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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
  * ``http://www.nominum.com''.
  */
 
+#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.";
+#endif
+
 #include <omapip/omapip_p.h>
 
 /* The handle table is a hierarchical tree designed for quick mapping
@@ -83,8 +88,6 @@ 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;
        }
@@ -101,11 +104,8 @@ 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,7 +176,6 @@ 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)
@@ -226,11 +225,8 @@ 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 7f20a035fe255e90f541e2947733fa4067c281cd..3f92acc333a610644215d460d42c6e64b38fdbc3 100644 (file)
@@ -3,7 +3,7 @@
    Routines for manipulating hash tables... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.6 2004/06/10 17:59:47 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include <omapip/omapip_p.h>
@@ -155,7 +155,6 @@ 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
@@ -195,8 +194,6 @@ 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 a9d76f753fe9f9d5521c2883ce640bd8df4a4d56..76ac5ceebd5b85735cc4275d3ef50eb3ff61e09e 100644 (file)
@@ -3,7 +3,7 @@
    Functions supporting the object management protocol... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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
  * ``http://www.nominum.com''.
  */
 
+#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.";
+#endif
+
 #include <omapip/omapip_p.h>
 
 OMAPI_OBJECT_ALLOC (omapi_protocol, omapi_protocol_object_t,
@@ -83,7 +88,6 @@ 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 4efde414d75efdcb96965483d2999fc23d88c2f3..c1412cc6bf723a103b430bdaa7ad23f4aef2c95e 100644 (file)
@@ -3,7 +3,7 @@
    Subroutines providing general support for objects. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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
  * ``http://www.nominum.com''.
  */
 
+#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.";
+#endif
+
 #include <omapip/omapip_p.h>
 
 omapi_object_type_t *omapi_type_connection;
@@ -248,7 +253,6 @@ 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 9245d27a37544bd8edbf1d3b371f51bad159f1b6..4ccba81e1f891bc6075596d918163d57a9018227 100644 (file)
@@ -5,7 +5,7 @@
    transactions... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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
  * learn more about Nominum, Inc., see ``http://www.nominum.com''.
  */
 
+#ifndef lint
+static char ocopyright[] =
+"$Id: trace.c,v 1.9.2.4 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+#endif
+
 #include <omapip/omapip_p.h>
 
 #if defined (TRACING)
@@ -285,8 +290,6 @@ 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,
@@ -338,7 +341,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 a6a67e969c68a02e83094b243b1852ef49c0c7c0..603ff2cab6b9d33f5d7f9ab3fab03e58df02209c 100644 (file)
@@ -3,7 +3,7 @@
    Parser for dhcpd config file... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.24 2004/11/24 17:39:18 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: confpars.c,v 1.143.2.25 2005/08/26 22:45:49 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1931,9 +1931,6 @@ 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 &&
@@ -2100,9 +2097,6 @@ 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 {
@@ -2372,7 +2366,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);
@@ -2916,7 +2910,6 @@ 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)
@@ -2924,7 +2917,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 70aacc258b8dbe74f1d6ea82c36e041a25fa567d..fce90a5d9e2db494691426b5ea32a33c94d643c0 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.192.2.52 2005/08/11 23:08:14 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.192.2.53 2005/08/26 22:45:49 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -2204,10 +2204,8 @@ 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 f6f650604391b8835b88861a82490d010ff78f33..477eddabfa81a11fc60c49e6ff7aa4fa7578a228 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: failover.c,v 1.53.2.38 2005/03/03 16:55:25 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: failover.c,v 1.53.2.39 2005/08/26 22:45:50 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -405,12 +405,11 @@ 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 06d0519e1ab5911a580ab3db7f6486b9d774a0e7..5dbd77fded57f9424adfb7179600c019ae07f3a5 100644 (file)
@@ -3,7 +3,7 @@
    OMAPI object interfaces for the DHCP server. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.19 2004/11/24 17:39:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: omapi.c,v 1.46.2.20 2005/08/26 22:45:50 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -881,7 +881,6 @@ 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;
@@ -2027,7 +2026,6 @@ 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);
@@ -2078,7 +2076,6 @@ 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;
@@ -2105,7 +2102,6 @@ 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 0e7eaccc0c57cc6dc1afe9a698a6b735329b0222..603dc2d75793fee1e57c7a55b4bebe1468db0d87 100644 (file)
@@ -3,7 +3,7 @@
    Memory allocation for the DHCP server... */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 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.5 2004/06/10 17:59:57 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$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";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -97,7 +97,6 @@ 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;
@@ -187,12 +186,13 @@ 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,7 +243,6 @@ struct permit *new_permit (file, line)
                                 dmalloc (sizeof (struct permit), file, line));
        if (!permit)
                return permit;
-       memset (permit, 0, sizeof *permit);
        return permit;
 }