Re: Buffer overflow in "lpr"

der Mouse (mouse@RODENTS.MONTREAL.QC.CA)
Wed, 09 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

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