Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2004 18:24:02 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        thib@mi.is
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Where is strnlen() ?
Message-ID:  <20040811.182402.52418639.imp@bsdimp.com>
In-Reply-To: <20040811193254.6f0be2c2.thib@mi.is>
References:  <20040811193254.6f0be2c2.thib@mi.is>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20040811193254.6f0be2c2.thib@mi.is>
            "Thordur Ivar B." <thib@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040811.182402.52418639.imp>