From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 11 19:32:47 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 32C0B16A4CE for ; Wed, 11 Aug 2004 19:32:47 +0000 (GMT) Received: from smtp.mi.is (smtp.mi.is [217.151.180.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8239B43D46 for ; Wed, 11 Aug 2004 19:32:46 +0000 (GMT) (envelope-from thib@mi.is) Received: from caulfield.bitcode.org (bofh.bitcode.org [217.151.165.254] (may be forged)) by smtp.mi.is (8.12.10/8.12.10/1.0.1) with SMTP id i7BJWiiv012989 for ; Wed, 11 Aug 2004 19:32:45 GMT Date: Wed, 11 Aug 2004 19:32:54 +0000 From: "Thordur Ivar B." To: freebsd-hackers@freebsd.org Message-Id: <20040811193254.6f0be2c2.thib@mi.is> Organization: n/a X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: 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: Wed, 11 Aug 2004 19:32:47 -0000 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