From owner-freebsd-emulation@FreeBSD.ORG Mon Jul 28 11:40:49 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B380A1065677 for ; Mon, 28 Jul 2008 11:40:49 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 555EF8FC18 for ; Mon, 28 Jul 2008 11:40:48 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from outgoing.leidinger.net (p54A575C9.dip.t-dialin.net [84.165.117.201]) by redbull.bpaserver.net (Postfix) with ESMTP id 4403F2E15A; Mon, 28 Jul 2008 13:40:40 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id B35746B4B1; Mon, 28 Jul 2008 13:40:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1217245237; bh=qLwd/uUWO4D6l2xDGlNrY/dOvwuxpC0on 9Z0sbEro/w=; h=Message-ID:Date:From:To:Cc:Subject:References: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=IyEbD7gxXmD820PI6wxoedy3jBispnr/Y9EJmxlzUTMidxf81RPa7OJmGhO5GazLn x9M0mSoaGOyKfrYH0E6UMx8U9ApyPCByrzg0EHXx6sOZHPFDz+v+uj2VEgKukTxIvU6 20j1xPFrPcDh2sZGypQvbo0RKZg7OzooqoBrjpZPlsg4atwSamkUF3nh97fWS8txCh+ ohyZ4CllreFm87CBUv8LEg8uMT80xuM8cFEB2I51h3b1bictkbk8ateLDhQS3FSrwjI eB3AQYdW3TFFIVFy96B68IdbTLsY9KA9TeMEa/zQPBYfYdsff43o99FaeE0ZCnAG441 sVGkxl67A== Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m6SBebFm004238; Mon, 28 Jul 2008 13:40:37 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Mon, 28 Jul 2008 13:40:37 +0200 Message-ID: <20080728134037.545016bbrhzspi68@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Mon, 28 Jul 2008 13:40:37 +0200 From: "Alexander Leidinger" To: "Chagin Dmitry" References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.2) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: 4403F2E15A.A2B4D X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.9, required 6, BAYES_00 -15.00, DKIM_SIGNED 0.00, DKIM_VERIFIED -0.00, RDNS_DYNAMIC 0.10) X-BPAnet-MailScanner-From: alexander@leidinger.net X-Spam-Status: No Cc: freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2008 11:40:49 -0000 Quoting "Chagin Dmitry" (from Mon, 28 Jul 2008 15:12:31 +0400 (MSD)): > On Mon, 28 Jul 2008, Chagin Dmitry wrote: > >> >> agree, we should do check before calculating linuxreclen, like: >> >> if (bdp->d_namlen > LINUX_NAME_MAX) { >> error = ENAMETOOLONG; >> goto out; >> } >> > > d_namlen declared as uint8_t, so comparison is always false. lets's > leave it will not changed FreeBSD d_namlen type? In the kernel I prefer defensive programming. Better safe than sorry. As long as there's no evidence that it is a performance bottleneck, there's no need to micro-optimize. Bye, Alexander. -- Capitalism can exist in one of only two states: welfare or warfare. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137