From owner-freebsd-hackers Tue Oct 9 18:34:16 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id A6E5737B403; Tue, 9 Oct 2001 18:34:10 -0700 (PDT) Received: (from ache@localhost) by nagual.pp.ru (8.11.6/8.11.6) id f9A1Y3L86219; Wed, 10 Oct 2001 05:34:04 +0400 (MSD) (envelope-from ache) Date: Wed, 10 Oct 2001 05:34:03 +0400 From: "Andrey A. Chernov" To: Bakul Shah Cc: Mike Barcroft , freebsd-hackers@FreeBSD.ORG, audit@FreeBSD.ORG Subject: Re: strnstr(3) - New libc function for review Message-ID: <20011010053402.A86108@nagual.pp.ru> References: <20011004215706.B34530@coffee.q9media.com> <200110100127.VAA22073@rodney.cnchost.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200110100127.VAA22073@rodney.cnchost.com> User-Agent: Mutt/1.3.21i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Oct 09, 2001 at 18:27:38 -0700, Bakul Shah wrote: > > Why not pass the length of the pattern as well? Regardless, > why not use simpler code that is easier to prove right? > > char* > strnstr(const char *s, size_t slen, const chat *p, size_t plen) It clearly violates API, passing two lengths. Remember that FreeBSD is not unique with strnstr(), some others have it too. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message