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"

der Mouse (mouseRODENTS.MONTREAL.QC.CA)
Wed, 9 Jul 1997 11:56:16 -0400

> 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.

The part after the last comma is the part I really miss.  I hesitate to
call strlen() when I could wind up walking through megabytes of trash
before discovering a NUL, or worse, walking off the end of the address
space and segfaulting.

                                        der Mouse

                               mouserodents.montreal.qc.ca
                     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B