]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Clean up a possible memory smash in the binding code.
authorTed Lemon <source@isc.org>
Mon, 12 Jun 2000 22:22:09 +0000 (22:22 +0000)
committerTed Lemon <source@isc.org>
Mon, 12 Jun 2000 22:22:09 +0000 (22:22 +0000)
common/execute.c
common/tree.c

index 0b599feb2159187916b1626299349226d79bdffb..00d6fd7f777212e9e037cb90ed38f443a73d19ef 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: execute.c,v 1.32 2000/05/16 23:02:18 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: execute.c,v 1.33 2000/06/12 22:22:09 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -238,6 +238,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
                        if (!binding && status) {
                                binding = dmalloc (sizeof *binding, MDL);
                                if (binding) {
+                                   memset (binding, 0, sizeof *binding);
                                    binding -> name =
                                            dmalloc (strlen
                                                     (r -> data.set.name) + 1,
@@ -305,6 +306,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
                      next_let:
                        if (ns) {
                                binding = dmalloc (sizeof *binding, MDL);
+                               memset (binding, 0, sizeof *binding);
                                if (!binding) {
                                   blb:
                                    binding_scope_dereference (&ns, MDL);
index 625147c8ac3fc2c76e7f5cf722d86ab334073f9c..9f3896982e0605d3cac6a64da989bf8972fdf012 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: tree.c,v 1.82 2000/05/17 16:04:04 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: tree.c,v 1.83 2000/06/12 22:22:08 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -486,10 +486,11 @@ int evaluate_expression (result, packet, lease,
                                binding_scope_dereference (&ns, MDL);
                                return 0;
                        } else {
+                               memset (nb, 0, sizeof *nb);
                                nb -> name = dmalloc (strlen (s -> string) + 1,
                                                      MDL);
                                if (nb -> name)
-                                       strcpy (binding -> name, s -> string);
+                                       strcpy (nb -> name, s -> string);
                                else {
                                        dfree (nb, MDL);
                                        nb = (struct binding *)0;