From owner-freebsd-net Thu Oct 4 9:19:38 2001 Delivered-To: freebsd-net@freebsd.org Received: from coffee.q9media.com (coffee.q9media.com [216.94.229.19]) by hub.freebsd.org (Postfix) with ESMTP id A163137B403; Thu, 4 Oct 2001 09:19:29 -0700 (PDT) Received: (from mike@localhost) by coffee.q9media.com (8.11.6/8.11.6) id f94GJXm33690; Thu, 4 Oct 2001 12:19:33 -0400 (EDT) (envelope-from mike) Date: Thu, 4 Oct 2001 12:19:33 -0400 From: Mike Barcroft To: Peter Pentchev Cc: freebsd-net@FreeBSD.ORG, freebsd-audit@FreeBSD.ORG Subject: Re: [CFR] whois(1) out-of-bound access patch Message-ID: <20011004121933.B31795@coffee.q9media.com> References: <20011004121640.C1959@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <20011004121640.C1959@ringworld.oblivion.bg>; from roam@ringlet.net on Thu, Oct 04, 2001 at 12:16:40PM +0300 Organization: The FreeBSD Project Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Peter Pentchev writes: > As described in PR bin/30968, whois(1) may access invalid data when > the whois server returns a non-newline-terminated string. > While it is true that the whois server maintainers should do a better > job of following standards and such, still the 'be liberal in what > you accept' mindset might be applied in this case, to fix what is > ultimately a subtle fgetln(3) use bug :) > > Any harm in committing the attached patch? And this - or something > like this - should be done soon; all FreeBSD whois clients currently > display weird behavior when querying .biz domains :\ Evil! :) You may want to notify the server administrator, as I tried using a variety of different whois clients and most of them have problems with it. [Over-engineered patch removed.] Would you please test the attached patch and confirm that it solves the problem? If it does, I'll commit it today. Best regards, Mike Barcroft --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="whois.20011004.diff" whois.20011004.diff A whois server may return a final line without a new line character. PR: 30968 Index: whois.c =================================================================== RCS file: /cvs/src/usr.bin/whois/whois.c,v retrieving revision 1.24 diff -u -r1.24 whois.c --- whois.c 5 Aug 2001 19:37:12 -0000 1.24 +++ whois.c 4 Oct 2001 15:57:56 -0000 @@ -303,7 +303,7 @@ strchr(name, '.') == NULL) nomatch = 1; } - printf("%s\n", buf); + printf("%.*s\n", (int)len, buf); } /* Do second lookup as needed. */ --mP3DRpeJDSE+ciuQ-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message