From junki@qn-lpr2-98.quicknet.inet.fi Sat Mar 13 06:31:54 1999
Return-Path: <junki@qn-lpr2-98.quicknet.inet.fi>
Received: from qn-lpr2-98.quicknet.inet.fi (qn-lpr2-98.quicknet.inet.fi [194.251.102.98])
	by hub.freebsd.org (Postfix) with ESMTP id 72C5D14C40
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 13 Mar 1999 06:31:52 -0800 (PST)
	(envelope-from junki@qn-lpr2-98.quicknet.inet.fi)
Received: (from junki@localhost)
	by qn-lpr2-98.quicknet.inet.fi (8.9.3/8.9.1) id QAA04496;
	Sat, 13 Mar 1999 16:31:34 +0200 (EET)
	(envelope-from junki)
Message-Id: <199903131431.QAA04496@qn-lpr2-98.quicknet.inet.fi>
Date: Sat, 13 Mar 1999 16:31:34 +0200 (EET)
From: Juha Nurmela <junki@qn-lpr2-98.quicknet.inet.fi>
Reply-To: junki@qn-lpr2-98.quicknet.inet.fi
To: FreeBSD-gnats-submit@freebsd.org
Subject: dhcp client receives garbage (dhclient prepend)
X-Send-Pr-Version: 3.2

>Number:         10568
>Category:       bin
>Synopsis:       dhcp client receives garbage (dhclient prepend)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 13 06:40:01 PST 1999
>Closed-Date:    Sat Dec 11 17:46:20 PST 1999
>Last-Modified:  Sat Dec 11 17:46:59 PST 1999
>Originator:     Juha Nurmela
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
ACME Inc.
>Environment:

	Internet Software Consortium DHCP Client V2.0b1pl17
	Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
	All rights reserved.

>Description:

	Sometimes /etc/resolv.conf gets garbage to the 'search' line.
	Looks like dhclient has trouble with the 'prepend' configuration
	and string data.

>How-To-Repeat:

	/etc/dhclient.conf:

		interface ep0 {
			prepend domain-name "z ";
			prepend domain-name-servers 127.0.0.1;
			script "nonexistent_just_testing_dhclient"
		}

	# dhclient -d -D ep0

	Now files /tmp/dcs* might contain trash in new_domain_name variable.
	Varying the length of the z above can reveal or hide the bug.

>Fix:

*** /usr/src/contrib/isc-dhcp/common/options.c.orig	Wed Feb 10 11:10:13 1999
--- /usr/src/contrib/isc-dhcp/common/options.c	Sat Mar 13 02:21:08 1999
***************
*** 518,525 ****
--- 518,530 ----
  			      case 't':
  				if (emit_quotes)
  					*op++ = '"';
+ #if 0
  				strcpy (op, (char *)dp);
  				op += strlen ((char *)dp);
+ #else
+ 				while (len-- && *dp)
+ 					*op++ = *dp++;
+ #endif
  				if (emit_quotes)
  					*op++ = '"';
  				*op = 0;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: obrien 
Responsible-Changed-When: Mon Apr 19 15:32:32 PDT 1999 
Responsible-Changed-Why:  
guess I'm mr. dhcp. 
State-Changed-From-To: open->closed 
State-Changed-By: obrien 
State-Changed-When: Sat Dec 11 17:46:20 PST 1999 
State-Changed-Why:  
This was fixed in the ISC 2.0 release. 
If this is still a problem, please send a new PR. 
Thank you. 
>Unformatted:
