Where is strnlen() ?

Thordur Ivar B. thib at mi.is
Wed Aug 11 12:32:47 PDT 2004


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.

PS: I know that I could use glibc but GPL disgusts me ;)

For more information about strnlen() see:
http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/baselib-strnlen-3.html

kv, thib[att]mi(dot).is

--
As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality.
                -- Albert Einstein


More information about the freebsd-hackers mailing list