From owner-freebsd-bugs Mon Jan 29 1:30:21 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B0B6937B69E for ; Mon, 29 Jan 2001 01:30:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0T9U2125541; Mon, 29 Jan 2001 01:30:02 -0800 (PST) (envelope-from gnats) Date: Mon, 29 Jan 2001 01:30:02 -0800 (PST) Message-Id: <200101290930.f0T9U2125541@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: bin/24707: [patch] Whois IP Address Handling Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/24707; it has been noted by GNATS. From: Peter Pentchev To: Mike Barcroft Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/24707: [patch] Whois IP Address Handling Date: Mon, 29 Jan 2001 11:24:39 +0200 On Mon, Jan 29, 2001 at 12:28:11AM +0000, Mike Barcroft wrote: > > >Number: 24707 > >Category: bin > >Synopsis: [patch] Whois IP Address Handling > >Originator: Mike Barcroft > >Organization: > Q9 Media > >Environment: > > $FreeBSD: src/usr.bin/whois/whois.c,v 1.16 2000/07/07 07:52:21 kris Exp $ > $FreeBSD: src/usr.bin/whois/whois.1,v 1.16 2000/11/20 19:21:19 ru Exp $ > > >Description: > > If a host is not specified and the user enters a query of > an IP address, query whois.arin.net instead of returning: > whois: 0.whois-servers.net: No Address associated with hostname > > >How-To-Repeat: > > Apply patches below. > > >Fix: > > --- whois.c.orig Fri Jul 7 07:52:21 2000 > +++ whois.c Sun Jan 28 19:08:14 2001 > @@ -49,6 +49,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -166,13 +167,19 @@ > } > } > if (j != 0) { > - qnichost = (char *) calloc(i - j + 1 + > - strlen(QNICHOST_TAIL), sizeof(char)); > - if (!qnichost) { > - err(1, "calloc"); > + if (isdigit(*(*argv + j + 1))) { Just a little comment - I think in checking for dotted-quad IP addresses you should be doing just that - check for dotted quads, not just check for a starting digit. Yes, I know that the RFC's forbid - or at least express a mild disagreement - with labels starting with a digit, but in the real world, your patch would break e.g. 'whois 42.com' :( G'luck, Peter -- I had to translate this sentence into English because I could not read the original Sanskrit. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message