From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 12 00:24:05 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03C3716A4CE for ; Thu, 12 Aug 2004 00:24:05 +0000 (GMT) Received: from harmony.village.org (rover.village.org [168.103.84.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 987CC43D1F for ; Thu, 12 Aug 2004 00:24:04 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.11/8.12.11) with ESMTP id i7C0NrIw098001; Wed, 11 Aug 2004 18:23:53 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 11 Aug 2004 18:24:02 -0600 (MDT) Message-Id: <20040811.182402.52418639.imp@bsdimp.com> To: thib@mi.is From: "M. Warner Losh" In-Reply-To: <20040811193254.6f0be2c2.thib@mi.is> References: <20040811193254.6f0be2c2.thib@mi.is> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: Where is strnlen() ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2004 00:24:05 -0000 In message: <20040811193254.6f0be2c2.thib@mi.is> "Thordur Ivar B." 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