From brawley@internode.com.au  Wed Oct  3 01:28:16 2001
Return-Path: <brawley@internode.com.au>
Received: from hamish.internode.com.au (hamish.internode.com.au [192.83.231.113])
	by hub.freebsd.org (Postfix) with ESMTP id 10AFE37B403
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  3 Oct 2001 01:28:15 -0700 (PDT)
Received: from internode.com.au (mad.internode.com.au [192.83.231.111])
	by hamish.internode.com.au (8.11.3/8.11.3) with ESMTP id f938SC465564;
	Wed, 3 Oct 2001 17:58:12 +0930 (CST)
Received: (from brawley@localhost)
	by internode.com.au (8.11.3/8.11.3) id f938SC302728;
	Wed, 3 Oct 2001 17:58:12 +0930 (CST)
Message-Id: <200110030828.f938SC302728@internode.com.au>
Date: Wed, 3 Oct 2001 17:58:12 +0930 (CST)
From: Ivan Brawley <brawley@internode.com.au>
Reply-To: brawley@internode.com.au
To: brawley@internode.com.au
Cc: newton@internode.com.au, FreeBSD-gnats-submit@freebsd.org,
	brawley@internode.com.au, justin@internode.com.au
In-Reply-To: <200110030810.f938ASC02640@internode.com.au> from Ivan Brawley at "Oct 3, 2001  5:40:28 pm"
Subject: Re: whois gives contents of /etc/services for bad .biz lookups

>Number:         31004
>Category:       bin
>Synopsis:       Re: whois gives contents of /etc/services for bad .biz lookups
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    roam
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 03 01:30:00 PDT 2001
>Closed-Date:    Sat Oct 6 04:58:07 PDT 2001
>Last-Modified:  Sat Oct 06 04:58:50 PDT 2001
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 --ELM710674628-452-0_
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 Ivan Brawley wrote saying:
 } They have got a suggested patch there too.
 } 
 } Might have a look at the lastest code for whois...
 
 The latest code in the cvs repo is too old, however, tryed out the patch and
 that works.
 
 ivan.
 --
 Ivan Brawley
 Internode Professional Access.
 
 --ELM710674628-452-0_
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Disposition: attachment; filename=whois.c.patch
 Content-Description: whois.c.patch
 Content-Transfer-Encoding: 7bit
 
 *** whois.c.orig	Wed Oct  3 17:44:14 2001
 --- whois.c	Wed Oct  3 17:46:39 2001
 ***************
 *** 51,56 ****
 --- 51,57 ----
   #include <arpa/inet.h>
   #include <ctype.h>
   #include <err.h>
 + #include <errno.h>
   #include <netdb.h>
   #include <stdarg.h>
   #include <stdio.h>
 ***************
 *** 243,249 ****
   {
   	FILE *sfi, *sfo;
   	struct addrinfo *res2;
 ! 	char *buf, *nhost, *p;
   	int i, nomatch, s;
   	size_t len;
   
 --- 244,250 ----
   {
   	FILE *sfi, *sfo;
   	struct addrinfo *res2;
 ! 	char *abuf, *buf, *nhost, *p;
   	int i, nomatch, s;
   	size_t len;
   
 ***************
 *** 267,272 ****
 --- 268,283 ----
   	nhost = NULL;
   	nomatch = 0;
   	while ((buf = fgetln(sfi, &len)) != NULL) {
 + 		abuf = NULL;
 + 		if ((len == 0) || !isspace(buf[len - 1])) {
 + 			abuf = calloc(1, len+1);
 + 			if (abuf == NULL) {
 + 				errno = ENOMEM;
 + 				err(1, "reallocating");
 + 			}
 + 			memcpy(abuf, buf, len);
 + 			buf = abuf;
 + 		}
   		while (len && isspace(buf[len - 1]))
   			buf[--len] = '\0';
   
 ***************
 *** 296,301 ****
 --- 307,313 ----
   				nomatch = 1;
   		}
   		printf("%s\n", buf);
 + 		free(abuf);
   	}
   
   	/* Do second lookup as needed. */
 
 --ELM710674628-452-0_--
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: asmodai 
State-Changed-When: Sat Oct 6 04:58:07 PDT 2001 
State-Changed-Why:  
Do not munge subject/synopsis lines. 


Responsible-Changed-From-To: gnats-admin->roam 
Responsible-Changed-By: asmodai 
Responsible-Changed-When: Sat Oct 6 04:58:07 PDT 2001 
Responsible-Changed-Why:  
Roam again. :)  see PR 31002, this is a follow-up 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31004 
>Unformatted:
