From owner-freebsd-hackers Tue Oct 22 08:03:49 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id IAA04189 for hackers-outgoing; Tue, 22 Oct 1996 08:03:49 -0700 (PDT) Received: from pdx1.world.net (pdx1.world.net [192.243.32.18]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id IAA04183 for ; Tue, 22 Oct 1996 08:03:44 -0700 (PDT) Received: from suburbia.net (suburbia.net [203.4.184.1]) by pdx1.world.net (8.7.5/8.7.3) with ESMTP id IAA15764; Tue, 22 Oct 1996 08:04:00 -0700 (PDT) Received: (proff@localhost) by suburbia.net (8.7.4/Proff-950810) id BAA23250; Wed, 23 Oct 1996 01:02:52 +1000 From: Julian Assange Message-Id: <199610221502.BAA23250@suburbia.net> Subject: Re: libc string routines don't check for NULL pointers To: imp@village.org (Warner Losh) Date: Wed, 23 Oct 1996 01:02:52 +1000 (EST) Cc: hackers@freebsd.org In-Reply-To: <199610221100.FAA15578@rover.village.org> from "Warner Losh" at Oct 22, 96 05:00:41 am X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > In message > "Daniel > O'Callaghan" writes: > : The string comparison (and other) routines in libc don't check for null > : pointers being passed. This results in SEGVs if one or both of the > : string pointers being passed is NULL. I can see a religious debate here, > : but I'm going to raise the issue: Should str*cmp() handle NULL arguments. > > str*cmp and friends should be hard asses about this and should give > the programer a nice core file when this happens, subject to local > security constraints. NULL pointer checking can slow down these > routines, but I've never seen numbers to back up speed differences. > > Just my humble opinion from about 10 years of doing this stick. > Others may disagree. No need to do this, just make sure the vm system never maps page 0. -- "Of all tyrannies a tyranny sincerely exercised for the good of its victims may be the most oppressive. It may be better to live under robber barons than under omnipotent moral busybodies, The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for own good will torment us without end, for they do so with the approval of their own conscience." - C.S. Lewis, _God in the Dock_ +---------------------+--------------------+----------------------------------+ |Julian Assange RSO | PO Box 2031 BARKER | Secret Analytic Guy Union | |proff@suburbia.net | VIC 3122 AUSTRALIA | finger for PGP key hash ID = | |proff@gnu.ai.mit.edu | FAX +61-3-98199066 | C7F81C2AA32D7D4E4D360A2ED2098E0D | +---------------------+--------------------+----------------------------------+