Where is strnlen() ?
M. Warner Losh
imp at bsdimp.com
Wed Aug 11 17:24:05 PDT 2004
In message: <20040811193254.6f0be2c2.thib at mi.is>
"Thordur Ivar B." <thib at mi.is> writes:
: While porting software from a friend wich was developed under Linux, I stumbled
: upon an error: src/socket.c:236: warning: implicit declaration of function
: `strnlen'
:
: Now my programming experience is nothing to brag about but I wonder why strnlen
: is not a part of FreeBSD's libc. I think that the use of strlen() insted of
: strnlen() could resault in buffer-overflow risks and my fellows (most of them
: are more experienced in the art of programming say that bounds checking is
: always good.)
:
: I have not found anything on google about this subject and if there is something
: that i overlooked then I'm real sorry for spamming this list.
strnlen() isn't a standardized function. It is a linuxism. Generally
FreeBSD only includes functions in libc that are part of Posix (or
traditionally been in BSD) to prevent namespace pollution.
Warner
More information about the freebsd-hackers
mailing list