Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2980981lqz; Wed, 3 Apr 2024 14:28:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIAMaW0Okgh/BKyudrRvYJ8LQEf5ZJk2ZS7gzI1bS6PE60pSMSNKo/SzrOn/id3l15A4ygi1CYH9bV/0VdD7ssnnK1ttivmd07SJ7TlA== X-Google-Smtp-Source: AGHT+IFizgbDKXfXDieerr0wJtlVMLaNPVPwXzlOmnqO1mIwp8Akg2Tdvb2EKTJQBIDySDxM77ub X-Received: by 2002:a05:6870:350d:b0:22e:8a0c:ea14 with SMTP id k13-20020a056870350d00b0022e8a0cea14mr571292oah.46.1712179727048; Wed, 03 Apr 2024 14:28:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712179727; cv=pass; d=google.com; s=arc-20160816; b=b/xr4TP8AcTbswG1myY3DoL1T33V5NFzKv59arxnwxpFx5HIEoXF2LDRnpEi5hwDw6 w96Wvg54MmHXVCXN+Go+htBcKDwStpjoyjHufsTHipCGcbN8uDTqsi+b0JrJyWZ5rm16 P986GkJI7eP+/Gklc2/Clx9CbeAgGYLp8TEJ1+hyVTQvKdFkyYnyLSPPN/0MX57oBIcq B4/KUf9Lsg09QtKhqMG6rJGrTIMMUPTG5kEQfI+rVJF4A/VuADsjAb6OzKCbXWtCeJAz hTuG5OO/UfMZos0DlAoh/bcpGoDJW1f9Az+LJ9Niud7DadXaCpCHLv6BHyogNp3S+8ks l5ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A7hT1bDm6uwQ8drV4Fteto7D8//xOnGyJfRith5G1SQ=; fh=WCfuwJfX/86wcMe6AX3y/pf5z/IcZnRaRDki5RcWj/w=; b=Pq+rz7849lYGsdYMwri7Nj/lrmJwigi6oNy5J2cAQEwvncg3PWZet8rco3eUPSK3z8 8yTOypFIjiDTX0VgaMD16bKGyHb7SBPoyXm64otKxs2Bsspb5ZtCXe1iz4JpoRxOX+0V XBc1vkh7veJ3EEQfXqu+0/q9rZ11ILlgeq/D+aFohgbGYmPkvWPCGKULo8dpxUXuE40+ cXdoyfP2OUxm/nmm9RYIMu5lzHjm2CUhZUaircUNrf0eidrPv1L6u5jndY7gNkn7i4Gn JDzDJszK3a8MTxkdgOIpddfDkGGKbPM4/yh1uzScoq4Va1T3LafVnmUy2/3K4/5Oku/x hRPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hz396Yjl; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-130623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 192-20020a6301c9000000b005f07209a2efsi13557563pgb.760.2024.04.03.14.28.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 14:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hz396Yjl; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-130623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6627B2876F0 for ; Wed, 3 Apr 2024 21:28:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14AAC15667F; Wed, 3 Apr 2024 21:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="hz396Yjl" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE472154C03 for ; Wed, 3 Apr 2024 21:28:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179720; cv=none; b=EN0uscYZceQYBrGWtTRynUVPtf8U/C4A/Sju5e3kZH5kl1/PcOYhww3t+S0YZLh0V1oNAek2srE7/rb4sUcvrSEChAXqekfh5h14iPrkj7g+iOv9a7ZgW489BFctuCvK0MPCiuVhNO0oxmk60EpJJkRRrmQzgajb2OJRjbeSaSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712179720; c=relaxed/simple; bh=Ge+rflQ68heO7Dqnl93qWvqW52u05lKmj6Bb7IZgcsI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CoHfS0G30iE8H3uzRGc5wfQHy0clROjo9djetAIlSqrAKm2qW6sQPG8uADfxx4G5RzDwPR0Xtca+4aFDDySmNcno27iYuaoELIbuICa9z2plGu9gkIzM77lWDMR//S6zQdH/zN8JrodMJUuSg8lDOgOzDhFlhKTlsnrr+yJWIe0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=hz396Yjl; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1e0bec01232so2451415ad.3 for ; Wed, 03 Apr 2024 14:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712179718; x=1712784518; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=A7hT1bDm6uwQ8drV4Fteto7D8//xOnGyJfRith5G1SQ=; b=hz396YjlZGrQwEA7LNmgv1z6KbCc0HC1+V1YnCnsy3R2wuUGq106ICp9naxMcZ+lzE AFboxNBKf9/BWoHJH7qIMjcRY2//O1t/lhxVSujEnL3gEipd2tu5P7itRQqkEw8xkHJq /f7rfdmROCoCzt8PihVPit3frIFZn38b1ebbo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712179718; x=1712784518; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=A7hT1bDm6uwQ8drV4Fteto7D8//xOnGyJfRith5G1SQ=; b=SlQXJlhpheElXSyAibGCzn4mLz1xeiWcQ1NgDjnhajQoOnQfp8K424V4bzYqxEjrn0 qBKQ3p4f6BYtk38573Tq8C7E5EVuPvvFGTbWMM25yclVcMeREJ4aj1wxQIa5aeZ8HgOm P1eglefaMoTr+crPVkum9P7wrYi3G926t2mXy0Z0iC7Gky38P013nVwVfHKnnQ3GcIlF MBNO/9XmDlL8dbi/Hn0rsJ86ePEitfGkFLQDYYkJDoKhBgdPRM89M2VHZprVoHpXoIST Q4hZahDDSEXEyinmqasbckfnSLkO1aLzzmavk2/0R+G+2wfnrz/KDPZeTYst/qpFVohP oJhg== X-Forwarded-Encrypted: i=1; AJvYcCXrYe7IjYR8nZtCILoKLQqQYs9XsmMn2e54fB13dH+T/HaS3TqgnKqxJSRVk14fTj0uURGrT02bNqTWiPOUdVZRzpgcnyzdSf5h3Iw/ X-Gm-Message-State: AOJu0YwWPNpCNuIKlVlWY/+QGqAAaFv/XGxGJxALGS01p5QRwg8SAkl7 yRlgTIB1MAfCEjXuOMC9M3gB1ZSBkra80utC0sJW/L3wZvCptvt+1AJEuCzDppSm7rhQX374eeU = X-Received: by 2002:a17:902:ecc8:b0:1e2:7ad5:19b3 with SMTP id a8-20020a170902ecc800b001e27ad519b3mr474309plh.43.1712179718159; Wed, 03 Apr 2024 14:28:38 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id t1-20020a170902e84100b001e0da190a07sm13808692plg.167.2024.04.03.14.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 14:28:37 -0700 (PDT) Date: Wed, 3 Apr 2024 14:28:36 -0700 From: Kees Cook To: Phillip Lougher Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, justinstitt@google.com Subject: Re: [PATCH] Squashfs: remove deprecated strncpy by not copying the string Message-ID: <202404031428.867B90D87D@keescook> References: <20240403183352.391308-1-phillip@squashfs.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403183352.391308-1-phillip@squashfs.org.uk> On Wed, Apr 03, 2024 at 07:33:52PM +0100, Phillip Lougher wrote: > Squashfs copied the passed string (name) into a temporary buffer > to ensure it was NUL-terminated. This however is completely > unnecessary as the string is already NUL-terminated. So remove > the deprecated strncpy() by completely removing the string copy. > > The background behind this unnecessary string copy is that it > dates back to the days when Squashfs was an out of kernel patch. > The code deliberately did not assume the string was NUL-terminated > in case in future this changed (due to kernel changes). This > would mean the out of tree patches would be broken but still > compile OK. > > Signed-off-by: Phillip Lougher Thanks! Reviewed-by: Kees Cook -- Kees Cook