[4934] in bugtraq
Re: Buffer overflow in "lpr"
daemon@ATHENA.MIT.EDU (Wietse Venema)
Thu Jul 17 12:57:11 1997
Date: Thu, 17 Jul 1997 12:39:08 -0400
Reply-To: Wietse Venema <wietse@WZV.WIN.TUE.NL>
From: Wietse Venema <wietse@WZV.WIN.TUE.NL>
X-To: mouse@RODENTS.MONTREAL.QC.CA
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To: <199707091556.LAA21811@Twig.Rodents.Montreal.QC.CA> from der
Mouse at "Jul 9, 97 11:56:16 am"
der Mouse wrote:
> > Try this on for size: strlcat(), [...]
>
> What _I_ most often want but don't have is strnlen():
>
> size_t strnlen(const char *str, size_t maxlen)
>
> Just like strlen(str), except that if no NUL is found in the
> first maxlen bytes, returns maxlen without attempting to access
> any further bytes.
On ANSI-C compliant systems, memchr(str, 0, len) does almost the
same (difference: the result is a pointer instead of a length).
Wietse