OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Bugtraq archives for 3rd quarter (Jul-Sep) 1997: Re: Buffer overflow in "lpr"

Re: Buffer overflow in "lpr"

Wietse Venema (wietseWZV.WIN.TUE.NL)
Thu, 17 Jul 1997 12:39:08 -0400

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