Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 1997 20:45:17 +1100
From:      David Nugent <davidn@labs.usn.blaze.net.au>
To:        "Daniel O'Callaghan" <danny@panda.hilink.com.au>
Cc:        hackers@freebsd.org
Subject:   Re: strlen() question
Message-ID:  <19970212204517.26504@usn.blaze.net.au>
In-Reply-To: <Pine.BSF.3.91.970212175317.427s-100000@panda.hilink.com.au>; from Daniel O'Callaghan on Feb 02, 1997 at 06:04:59PM
References:  <Pine.BSF.3.91.970212175317.427s-100000@panda.hilink.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970212204517.26504>