From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 10 16:59:43 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E34E106566B; Tue, 10 Nov 2009 16:59:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 70B4F8FC1B; Tue, 10 Nov 2009 16:59:41 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id nAAGxaZv091698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Nov 2009 18:59:36 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id nAAGxaLM065435; Tue, 10 Nov 2009 18:59:36 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id nAAGxaC9065434; Tue, 10 Nov 2009 18:59:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 10 Nov 2009 18:59:36 +0200 From: Kostik Belousov To: Nate Eldredge Message-ID: <20091110165936.GC2331@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FyU5fTJCTr/6Eq8v" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Alexander Best , Giorgos Keramidas , freebsd-hackers@freebsd.org, Dag-Erling Sm?rgrav Subject: Re: [patch] burncd: honour for envar SPEED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2009 16:59:43 -0000 --FyU5fTJCTr/6Eq8v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2009 at 08:03:26AM -0800, Nate Eldredge wrote: > On Tue, 10 Nov 2009, Alexander Best wrote: >=20 > >ps: would be nice if strcasecmp could protect itself from segfault with= =20 > >one or > >both of the args being NULL. >=20 > I disagree. What do you think it should do instead? Return 0? If it=20 > did, would you have found your bug? >=20 > The same argument could be made for any of the string.h functions, but I= =20 > don't think it actually holds water. Such checks add overhead, and only= =20 > provide an illusion of safety. Sure, strcasecmp could avoid causing the= =20 > segfault itself, but at the cost of letting a broken program continue and= =20 > possibly cause more damage. It could call abort(), but then you'd just= =20 > have the same result (program terminates) with a different signal, and=20 > doing your check in software rather than letting the MMU hardware do it.= =20 > It could print a message, but that pollutes the program's output, and 15= =20 > seconds debugging the core dump will reveal the problem anyway. >=20 > Having a library function "protect itself" in this manner is not actually= =20 > helpful, IMHO. I remember System V to actually map zero page at 0, thus causing all string functions to behave like it was supplied empty string when argument is NULL. I believe Solaris still provides the library that could be LD_PRELOADed for the same effect. --FyU5fTJCTr/6Eq8v Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkr5m/cACgkQC3+MBN1Mb4jYmgCg5jHeHRzSzO+PvtkNvOxyjYzT od4An0/l2yjXKYZdvKtAiIaIeUvi0xlt =u16l -----END PGP SIGNATURE----- --FyU5fTJCTr/6Eq8v--