Date: Mon, 28 Jul 2008 13:40:37 +0200 From: "Alexander Leidinger" <Alexander@Leidinger.net> To: "Chagin Dmitry" <chagin.dmitry@gmail.com> Cc: freebsd-emulation@freebsd.org Subject: Re: kern/117010: [linux] linux_getdents() get somethinng like buffer overflow Message-ID: <20080728134037.545016bbrhzspi68@webmail.leidinger.net> In-Reply-To: <alpine.BSF.1.10.0807281508380.1594@ora.chd.net> References: <200807250700.m6P70FSF036132@freefall.freebsd.org> <20080726091045.4c617dc7@deskjail> <alpine.BSF.1.10.0807271958020.3912@ora.chd.net> <20080728085403.58063b2gbchdjtic@webmail.leidinger.net> <alpine.BSF.1.10.0807281300060.1453@ora.chd.net> <alpine.BSF.1.10.0807281508380.1594@ora.chd.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Quoting "Chagin Dmitry" <chagin.dmitry@gmail.com> (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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080728134037.545016bbrhzspi68>