Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/dhcp/common Fix a bug where a clause in the client ...



details:   https://anonhg.NetBSD.org/src/rev/ee0ed53bba22
branches:  trunk
changeset: 485285:ee0ed53bba22
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Apr 24 05:27:51 2000 +0000

description:
Fix a bug where a clause in the client configuration file like:

        default nis-domain "";

would cause a NULL pointer deref while writing out the lease into
the persistent database if the server didn't include an nis-domain
option in the reply.

diffstat:

 usr.sbin/dhcp/common/options.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 1aaffa221615 -r ee0ed53bba22 usr.sbin/dhcp/common/options.c
--- a/usr.sbin/dhcp/common/options.c    Mon Apr 24 02:53:05 2000 +0000
+++ b/usr.sbin/dhcp/common/options.c    Mon Apr 24 05:27:51 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.1.1.10 2000/04/22 07:11:36 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.2 2000/04/24 05:27:51 thorpej Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -672,8 +672,10 @@
                              case 't':
                                if (emit_quotes)
                                        *op++ = '"';
-                               strcpy (op, (const char *)dp);
-                               op += strlen ((const char *)dp);
+                               if (len != 0) {
+                                       strcpy (op, (const char *)dp);
+                                       op += strlen ((const char *)dp);
+                               }
                                if (emit_quotes)
                                        *op++ = '"';
                                *op = 0;



Home | Main Index | Thread Index | Old Index