Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp763384lqd; Wed, 24 Apr 2024 16:55:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSzxPWzT3z/2+p0rBS55fgjNOXhDELq8HPC/ab0oZNbiyPXXSvTnlxktXrZhRO5SX97gPv/AT1CD7k0bcORPyUuVMDHspw5S600hyWoQ== X-Google-Smtp-Source: AGHT+IEBSacDBY0kyQmoE+S/tpTuMTxXiRLikIVYD7un3RdFNHLpNCw0B7GZYpmbpX/xtLdAGEpE X-Received: by 2002:a17:906:a951:b0:a58:7985:8eae with SMTP id hh17-20020a170906a95100b00a5879858eaemr2342975ejb.76.1714002954103; Wed, 24 Apr 2024 16:55:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714002954; cv=pass; d=google.com; s=arc-20160816; b=JvAOeJiHGzNF80pD0WSPh2yYw+1VYbaQHnBRezRZlC7lwK1lL5YsXhnU65AEXX30MY gauhWWHUxJLarcQb7qcCsQzllXTMOGyqeBiEBC9WdfaGZtOUbrswh3PiFLB26Xog77Ha 33OS1d6fTxPrQ99BZZW3Fht1Gccfynepg5kqe6jvB+Dm+9TKf28gqESJgfVpy1jZUmN0 kcNkKGhTX7pYG21lAuMt3TDvsIjFHO0pG2CcHaRNf0U+McRAfjmMimdXve0MGW+imNW1 iHazud504rkb2qyRk/r4HFu5Ot+EhOuqT34SsbVvHQWMt/Zkua8jQsKJCiG2tfLKn7h2 3C/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=kk1vBtrkPJtfbNkGtrMy2gilqU9fSeCuVJ9F0az9iBg=; fh=s8Y204xG+4mvNPZgQdtGsfcPaGorSRsezXCAm/tfCP0=; b=OEfTD+sTMfuZfgOUuJvptQ8ReXRXIhd3s0yd4Lc62SMz49eu6jk8DK2OcOYrflDIeA T8BBSU0PL1qZPzd5E0By1qJyPm+FuVRaQ7UGJtRlNcjjp6NEN0W7SZTu1vjIwkxzGSeT DY9Ha3h/pVHS3bYC0uUIFkRAL3YAsaTwBzogm641hPzn8dp/h1rzj1l9Hg1vfG5OEiUd so9hdvIWxKttg8EpGZHgdjwEOtaFBqfEiMz/cjseicDaKsSQoVG4LATfn1JnLYXr8OP5 oEahwOZ+AcrhST6wf2yWxY+awPSSQIm+JyxliMDTA9Mg2+jf1wJx+l1SJOgTB2uqkwle Wl3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WeyPt2Gv; 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-157863-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157863-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id hd15-20020a170907968f00b00a556d19c336si9633676ejc.1015.2024.04.24.16.55.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:55:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157863-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WeyPt2Gv; 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-157863-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157863-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D23C61F24D9B for ; Wed, 24 Apr 2024 23:55:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E3A916F288; Wed, 24 Apr 2024 23:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WeyPt2Gv" Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (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 6162B16F0DE for ; Wed, 24 Apr 2024 23:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714002943; cv=none; b=tCRezgvq5PCRIfwvzln/g8Lwn61j3kw8LKwkoNiIEXqDpD4deyASgRpUsiXMVzNu3RZHpIKyRTFYF6ffW6c7DgmnjH/vcU66xodDHsn6UKfPBI3XQ4lomzZIe9iq6kLzOVDY0uYHDJ6e+r/OayezEvXbbNWTdjk50OqC2kWyDtc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714002943; c=relaxed/simple; bh=2/Hfa/dcWjkxZew9ys7tmCgP1thDGraOO4tncLETr3A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=kdQred5xI1R/YG7FPxngS6R3BHOzzZOzustZscGhU3B3O+dv2DdoC+YjM+N3UxOVsPudEE1M9egCA4Lo+/0YP8dRgk0L8wlGefSDCvvoIF+PGyGbqnGmAb/oZcSLWq0FEZCZdCtZ3ui7SmGGR7jj00A1y9X3QIM75QYoiDtHd3U= 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=WeyPt2Gv; arc=none smtp.client-ip=209.85.160.50 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-oa1-f50.google.com with SMTP id 586e51a60fabf-238e171b118so268659fac.3 for ; Wed, 24 Apr 2024 16:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714002941; x=1714607741; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kk1vBtrkPJtfbNkGtrMy2gilqU9fSeCuVJ9F0az9iBg=; b=WeyPt2Gv565dYBLzpmykhuB92ZbEINflIqMiaqPhWirBf4MQjRHShLrIKCx+9FK9Ds ErBWdZPVsARWyBt1ROfTrzNWEyOLCk0qQmfa3YoQYLMZONgL6AfR7CpuIm9XczaMn9P9 EpxeSIhGdAyiGbWH5m1Z6x6CKbXjYkDKlvLZ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714002941; x=1714607741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kk1vBtrkPJtfbNkGtrMy2gilqU9fSeCuVJ9F0az9iBg=; b=aL1FQRC0M+t+BhL6ZqZTNR1MHqBCtylP35FYXsHpgWlghfohsIpXfgohekEm8tWjzP hDNyqD4uJaVoMjhvuenN3vtxett79E8khKnNAoMWu91HE2IPgE6kmhbicL2hBKHh3lc+ UmDxc2OOxIdY6Qy1BSGj3Q1OYLkqquqn+iKAyBIMIBXzb4DeGheiuvWBT/Gq8S85TL+9 DdEQLqvEsh1tGYSRlMPDnd+fWkhyMMt3FoekK5VNkk7H4E4D6z8/biSn/LZPOJjM9qqF yogBnYfB0+fLdxQtuCn+iAZeUCxnNeZzobJzEKDuxBSIsMv0FkqHaEY9X6/ndNLBpqqK SPQw== X-Forwarded-Encrypted: i=1; AJvYcCWRRFgOi+uy4a9CYTVb6MLZiH4mxkw2f1sMcWnh1S7m0LsHj1VFPM2U3myDCWBpQf35KfmHejJNzEZOdB9Exx/Ilv1d6Kxd9atbYJAp X-Gm-Message-State: AOJu0Ywh7Deym59Z8l/3Z3XwbhW1/IDcLzeyxZjzjxVqvXoB0DYYaXCp J2wzZSLEJiMCjIfrjt3SBkJI/16sZQ7PpqCVrJVGUaU2ExCtcXO/pXWJpgU6sg== X-Received: by 2002:a05:6870:a686:b0:23b:1dd5:3df7 with SMTP id i6-20020a056870a68600b0023b1dd53df7mr2924743oam.47.1714002941396; Wed, 24 Apr 2024 16:55:41 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id fx25-20020a056a00821900b006e6c88d7690sm11952827pfb.160.2024.04.24.16.55.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 16:55:40 -0700 (PDT) From: Kees Cook To: Justin Stitt Cc: Kees Cook , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] hfsplus: refactor copy_name to not use strncpy Date: Wed, 24 Apr 2024 16:55:38 -0700 Message-Id: <171400293647.3284001.3215911382372065308.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240401-strncpy-fs-hfsplus-xattr-c-v2-1-6e089999355e@google.com> References: <20240401-strncpy-fs-hfsplus-xattr-c-v2-1-6e089999355e@google.com> 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="utf-8" Content-Transfer-Encoding: 8bit On Mon, 01 Apr 2024 18:10:48 +0000, Justin Stitt wrote: > strncpy() is deprecated with NUL-terminated destination strings [1]. > > The copy_name() method does a lot of manual buffer manipulation to > eventually arrive with its desired string. If we don't know the > namespace this attr has or belongs to we want to prepend "osx." to our > final string. Following this, we're copying xattr_name and doing a > bizarre manual NUL-byte assignment with a memset where n=1. > > [...] Applied to for-next/hardening, thanks! [1/1] hfsplus: refactor copy_name to not use strncpy https://git.kernel.org/kees/c/628a89b6ef79 Take care, -- Kees Cook