Bug 14041

Summary: "host" blows up with incomplete arguments
Product: Base System Reporter: pauls <pauls>
Component: binAssignee: Peter Wemm <peter>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.3-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
host.c.patch none

Description pauls 1999-09-30 01:30:01 UTC
	If you give the "host" command some flags but nothing
	to query, it dies and dumps core.

How-To-Repeat: 
pauls@deadbeef(11)% host -t any highwing.cdrom.com
highwing.cdrom.com has address 204.216.28.168
highwing.cdrom.com mail is handled (pri=10) by pike.cdrom.com
highwing.cdrom.com mail is handled (pri=5) by zippy.cdrom.com
pauls@deadbeef(12)% host -t any
Segmentation fault (core dumped)
Comment 1 Sheldon Hearn 1999-09-30 11:58:42 UTC
On Wed, 29 Sep 1999 20:19:58 -0400, Paul Southworth wrote:

> 	If you give the "host" command some flags but nothing
> 	to query, it dies and dumps core.

This is why it should be using getopt. :-)

Ciao,
Sheldon.
Comment 2 Ruslan Ermilov 1999-10-01 14:38:06 UTC
On Wed, Sep 29, 1999 at 08:19:58PM -0400, Paul Southworth wrote:
> 
> >Number:         14041
> >Category:       bin
> >Synopsis:       "host" blows up with incomplete arguments
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    freebsd-bugs
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   current-users
> >Arrival-Date:   Wed Sep 29 17:30:01 PDT 1999
> >Closed-Date:
> >Last-Modified:
> >Originator:     Paul Southworth
> >Release:        FreeBSD 3.3-RELEASE i386
> >Organization:
> Internet Engineering Group
> >Environment:
> 
> 	FreeBSD 3.3-RELEASE, nothing unusual
> 
> >Description:
> 
> 	If you give the "host" command some flags but nothing
> 	to query, it dies and dumps core.
> 
> >How-To-Repeat:
> 
> pauls@deadbeef(11)% host -t any highwing.cdrom.com
> highwing.cdrom.com has address 204.216.28.168
> highwing.cdrom.com mail is handled (pri=10) by pike.cdrom.com
> highwing.cdrom.com mail is handled (pri=5) by zippy.cdrom.com
> pauls@deadbeef(12)% host -t any
> Segmentation fault (core dumped)
> 
The attached patch fixes the problem.

-- 
Ruslan Ermilov		Sysadmin and DBA of the
ru@ucb.crimea.ua	United Commercial Bank,
ru@FreeBSD.org		FreeBSD committer,
+380.652.247.647	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 3 marka 1999-10-01 14:59:20 UTC
	This was fixed in BIND 8.2.

	Mark

> 
> --FL5UXtIhxfXey3p5
> Content-Type: text/plain; charset=us-ascii
> 
> On Wed, Sep 29, 1999 at 08:19:58PM -0400, Paul Southworth wrote:
> > 
> > >Number:         14041
> > >Category:       bin
> > >Synopsis:       "host" blows up with incomplete arguments
> > >Confidential:   no
> > >Severity:       non-critical
> > >Priority:       low
> > >Responsible:    freebsd-bugs
> > >State:          open
> > >Quarter:        
> > >Keywords:       
> > >Date-Required:
> > >Class:          sw-bug
> > >Submitter-Id:   current-users
> > >Arrival-Date:   Wed Sep 29 17:30:01 PDT 1999
> > >Closed-Date:
> > >Last-Modified:
> > >Originator:     Paul Southworth
> > >Release:        FreeBSD 3.3-RELEASE i386
> > >Organization:
> > Internet Engineering Group
> > >Environment:
> > 
> > 	FreeBSD 3.3-RELEASE, nothing unusual
> > 
> > >Description:
> > 
> > 	If you give the "host" command some flags but nothing
> > 	to query, it dies and dumps core.
> > 
> > >How-To-Repeat:
> > 
> > pauls@deadbeef(11)% host -t any highwing.cdrom.com
> > highwing.cdrom.com has address 204.216.28.168
> > highwing.cdrom.com mail is handled (pri=10) by pike.cdrom.com
> > highwing.cdrom.com mail is handled (pri=5) by zippy.cdrom.com
> > pauls@deadbeef(12)% host -t any
> > Segmentation fault (core dumped)
> > 
> The attached patch fixes the problem.
> 
> -- 
> Ruslan Ermilov		Sysadmin and DBA of the
> ru@ucb.crimea.ua	United Commercial Bank,
> ru@FreeBSD.org		FreeBSD committer,
> +380.652.247.647	Simferopol, Ukraine
> 
> http://www.FreeBSD.org	The Power To Serve
> http://www.oracle.com	Enabling The Information Age
> 
> --FL5UXtIhxfXey3p5
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="host.c.patch"
> 
> Index: host.c
> ===================================================================
> RCS file: /usr/FreeBSD-CVS/src/contrib/bind/bin/host/host.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 host.c
> --- host.c	1998/05/03 04:09:49	1.1.1.1
> +++ host.c	1999/10/01 12:32:39
> @@ -175,10 +175,6 @@
>  	res_init();
>  	_res.retrans = 5;
>  
> -	if (c < 2) {
> -		fprintf(stderr, "Usage: host [-w] [-v] [-r] [-d] [-t querytype]
>  [-c class] [-a] host [server]\n  -w to wait forever until reply\n  -v for ve
> rbose output\n  -r to disable recursive processing\n  -d to turn on debugging
>  output\n  -t querytype to look for a specific type of information\n  -c clas
> s to look for non-Internet data\n  -a is equivalent to '-v -t *'\n");
> -		exit(1);
> -	}
>  	while (c > 2 && v[1][0] == '-') {
>  		if (strcmp (v[1], "-w") == 0) {
>  			_res.retry = 1;
> @@ -228,6 +224,10 @@
>  			c--;
>  		}		
>          }
> +	if (c < 2) {
> +		fprintf(stderr, "Usage: host [-w] [-v] [-r] [-d] [-t querytype]
>  [-c class] [-a] host [server]\n  -w to wait forever until reply\n  -v for ve
> rbose output\n  -r to disable recursive processing\n  -d to turn on debugging
>  output\n  -t querytype to look for a specific type of information\n  -c clas
> s to look for non-Internet data\n  -a is equivalent to '-v -t *'\n");
> +		exit(1);
> +	}
>  	if (c > 2) {
>  		s = v[2];
>  		server_specified++;
> 
> --FL5UXtIhxfXey3p5--
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka@isc.org
Comment 4 ru freebsd_committer freebsd_triage 1999-10-01 15:20:44 UTC
State Changed
From-To: open->closed

Mark Andrews <marka@isc.org> reports that the problem has been 
fixed in BIND 8.2, so this PR is superseded by PR misc/13837. 


Comment 5 ru freebsd_committer freebsd_triage 1999-10-01 15:20:44 UTC
Responsible Changed
From-To: freebsd-bugs->peter

Just to let Peter know :-)