Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755283AbZKMCMU (ORCPT ); Thu, 12 Nov 2009 21:12:20 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755094AbZKMCMQ (ORCPT ); Thu, 12 Nov 2009 21:12:16 -0500 Received: from smtp104.prem.mail.sp1.yahoo.com ([98.136.44.59]:45236 "HELO smtp104.prem.mail.sp1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754821AbZKMCMP (ORCPT ); Thu, 12 Nov 2009 21:12:15 -0500 X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- X-YMail-OSG: bb.q1NsVM1kqP5A8xfc5CSd8MYB1WjVb14XPy7C4xgfy5w20al5392_.kSY9NRHqZU8E3WSIW6AZR9yGnEnOz6VSWPAKNGsioq1k6T_LI2NLTf2.7VNtaKxq5u687Hi.FUS83Z54Gnz7YpbqFTL16A_QkBFc3xPm2RYYH._csjJNgIjEtufKChXrzvw4sfyiY9KmYGrjLBUAutcwCARONeT7rJy9drDUsMRzvec1QDczY5VrEc1ebQ8IyRUSdvy0cammL46wx3ZTmK5pcvGlWLs9eeFCTA2fjBiKUPkJOni2sbolLhU283g- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4AFCC06B.1030302@schaufler-ca.com> Date: Thu, 12 Nov 2009 18:11:55 -0800 From: Casey Schaufler User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: James Morris CC: Julia Lawall , "Serge E. Hallyn" , Stephen Smalley , Eric Paris , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH 3/4] security/selinux: decrement sizeof size in strncmp References: <20091112145314.GA24682@us.ibm.com> <4AFC3620.2020809@schaufler-ca.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1110 Lines: 35 James Morris wrote: > On Thu, 12 Nov 2009, Casey Schaufler wrote: > > >> I strongly suggest that this is not what is wanted. >> strcmp(x,y) >> and >> strncmp(x,y,sizeof(y)) >> >> are functionally equivalent and strcmp has a bad reputation in >> the security community because it is associated with potential >> buffer overrun issues. >> > > Do you see potential for a buffer overrun in this case? > No, but I hate arguing with people who think that every time they see strcmp that they have found a security flaw. The existing code does exactly what it is intended to. Why make a change that just clutters things up? > The strings being compared are "sysfs" and the name field of 'struct > file_system_type'. The kernel code elsewhere assumes the latter string to > be a valid zero-terminated string, and we should, too. > > > - James > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/