From owner-freebsd-hackers Wed Feb 12 01:45:34 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id BAA18905 for hackers-outgoing; Wed, 12 Feb 1997 01:45:34 -0800 (PST) Received: from labs.usn.blaze.net.au (labs.usn.blaze.net.au [203.17.53.30]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id BAA18900 for ; Wed, 12 Feb 1997 01:45:29 -0800 (PST) Received: (from davidn@localhost) by labs.usn.blaze.net.au (8.8.5/8.8.5) id UAA16166; Wed, 12 Feb 1997 20:45:17 +1100 (EST) Message-ID: <19970212204517.26504@usn.blaze.net.au> Date: Wed, 12 Feb 1997 20:45:17 +1100 From: David Nugent To: "Daniel O'Callaghan" Cc: hackers@freebsd.org Subject: Re: strlen() question References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.61 In-Reply-To: ; from Daniel O'Callaghan on Feb 02, 1997 at 06:04:59PM Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk On Feb 02, 1997 at 06:04:59PM, Daniel O'Callaghan wrote: > Below is the code for strlen() from libc. It is extremely simple, and > fast. Is it really safe to assume that strlen() will never exceed process > memory bounds before striking a '\0'? This is the programmer's responsibility. > Or should there be a strnlen() function in libc for checking the > length of suspicious strings? No. FWIW, you can use memchr(3) for that. Regards, David Nugent - Unique Computing Pty Ltd - Melbourne, Australia Voice +61-3-9791-9547 Data/BBS +61-3-9792-3507 3:632/348@fidonet davidn@freebsd.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/