From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 6A1FC405F7 for ; Sat, 27 Jun 2026 18:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782584396; cv=none; b=RNbYIIK4n808akfsgy8QuwCGKqJTPMXc1NOFcynhDNEUHAz6uBAWYNDbNOqZh33dTA8/oiRn5mdx0Q/ltg+wTlqeR3RBalj3N4Dav2OUjgvPaiCEMvH+eybJMun4qkAX7skxDluIoZRILxXvfeIy70mfIeAZQtd6tFqlXyzzW2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782584396; c=relaxed/simple; bh=20Ln9csoAe4XA8wUX5nA+q4Hm+wpLFbTSlP18d9DOR4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rzrtVALiu22GCGvMgynkQmvmoK/yQPga6oWGB1K3PXfWfgO7IbqDp1l47J5pcCQ8rNkSMM3s0AEGBjnoBum7mRKSWbXQd+cqLf58TbOiWo7poadmMkJSXdQnlk8Kt7IXLX4ILtHoQm2Nk9IxhLXhQ3FiIhfPOfhhXgp7OXSZ9+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZFtk1yUQ; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZFtk1yUQ" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-68bd9fce347so3668659a12.2 for ; Sat, 27 Jun 2026 11:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782584394; x=1783189194; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fl6lDfdiJsamGPbGtesRYSCup9cZCxwytdhfAw1QcpQ=; b=ZFtk1yUQ4UmX0ZRKA0ZOqxJCWiMDNa6cpAc+2sctRWtphRlcb8fC5WxnEaV3dps9X+ NZ7kBCG+p31qKXsG7fFDXb8pNrFKSlMyaENAd96LqRtN07zRNP/yWC/YDBH7SixybrZM NJRmYHfVR2PQJkIyPdVt9/UJ3naeaijfCvHOYUUF+5d5oO046sDjYIWOh12FT2sptaN5 iThK9pwadMg7QWdEBMihnERAIsEQ2Ctdr9HLa3rBuJ38XK6dmn4RMW4ZzbDs1Yhv4U/M A8tGvO+FwM1DlIOLZcyuEgfvOA6M1iy29J00HJyrzrr/7x0AKLqEP7IETDmGqSFit7Vl EzDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782584394; x=1783189194; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fl6lDfdiJsamGPbGtesRYSCup9cZCxwytdhfAw1QcpQ=; b=oOtpkfUY5ehE5RpmVH7b/TrK1lEZpB2wxOOu6ThTKu2gf3DxWzCvCBOvkRY1qA4x8R XppuqWf2fxHgR6xi6KZ8749WU8VPvRD1vxDEbRRD7zOssRBatzrab3C8NCxrw6ckcob5 MWXJL21X2o3a5EgccxyTG6kdpTylBJeApPn22TmbU2uEwEFHRuz5EyN4YTfPT4/xEvZn itnSMKI2iM9NeWllyMZUP2S0rG4lkcasuYR/OggAA2M7byoji5OripQRIR9CiK19+Xyi f3e3BKhrCvmFVkB/vB62cxNCOoMzuaTyr9jAI7DuYqbC6vmwx/D7BuycaE1OIzq2IC62 kIHg== X-Forwarded-Encrypted: i=1; AHgh+Roqi0+qUrwm00V3Ha/Mo+DgaRHKbEDIbMWqCcKUvhzTEU1jBuFtn0GiynVeQKCissPJTNcJVxVYPrJIxhc=@vger.kernel.org X-Gm-Message-State: AOJu0YyB5q1SYsJkWTwN8JNIwmi2x4BqAbUpc/lrZu59der83sAjr9zV hg/ApiE/4XY2CwoVEzrbvXdn+xZClK2NLrLN7loy90+svWwap6o78Nj8 X-Gm-Gg: AfdE7clDPQ1uAtZsgxCGILnmPHZ8DAFuWkTTBiM2fPJcyV+UuWZvgbNrKVw5DsE0YPF m+gCaFCe4xKos2tPQN4XM5hg+Ai1abHrixYUJUuEuaKT2OHiulgeSZ463WENEu5YCv00xzWh2Rp EbmWCRCQRfgPfuxx6UgCx8akf8ZTkZpqQZQbSTi+a1Df+OGgkAM24ix4J/4ZmDZVu5DKK0S9bIE vzVOHwaGluVnZxH9mmiSps9gFhMfuUn6E9sApzuH+U+5QDXA/r8vXBHxjiMc5maZU2VTY8JSzHW MBrXr8cxKsoeTu2bbIzrB7x0VoxMIOaAwtHvXNicoHuNKxLs2qmtifWhTmF2lxrnpxGy2osVu7m Zi2iohFLQqW5Yf1n6a97ib1TQ4Ejhvci4ZI2g930yKxlyteDKxcIpYo9Zt/y5EAB+B6rVFj3tKR j9AsdCJN/a03696t4qWgZEHlACEb15sozmKjw= X-Received: by 2002:a05:6402:520a:b0:697:808e:cacf with SMTP id 4fb4d7f45d1cf-69835e1e5b2mr2178752a12.1.1782584393609; Sat, 27 Jun 2026 11:19:53 -0700 (PDT) Received: from localhost.localdomain ([72.255.58.127]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6980ed6f0a9sm2957411a12.19.2026.06.27.11.19.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2026 11:19:53 -0700 (PDT) From: Mahad Ibrahim To: Jan Kara Cc: linux-upf@vger.kernel.org, linux-kernel@vger.kernel.org, Mahad Ibrahim Subject: [PATCH] udf: use strscpy() instead of strcpy() for regid ident field Date: Sat, 27 Jun 2026 18:19:48 +0000 Message-ID: <20260627181948.2118-1-mahad.ibrahim.dev@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit strcpy() is deprecated as it performs no bounds checking. Replace the three call sites that copy UDF_ID_DEVELOPER into the regid ident field with strscpy(). The current string fits the field with room to spare, so there is no overflow today. strscpy() bounds the copy to the destination and NUL-terminates, keeping it safe if the string or the field size changes later. Signed-off-by: Mahad Ibrahim --- fs/udf/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 67bcf83758c8..3140e001b315 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -1809,7 +1809,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) } eid = (struct regid *)dsea->impUse; memset(eid, 0, sizeof(*eid)); - strcpy(eid->ident, UDF_ID_DEVELOPER); + strscpy(eid->ident, UDF_ID_DEVELOPER, sizeof(eid->ident)); eid->identSuffix[0] = UDF_OS_CLASS_UNIX; eid->identSuffix[1] = UDF_OS_ID_LINUX; dsea->majorDeviceIdent = cpu_to_le32(imajor(inode)); @@ -1833,7 +1833,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) udf_time_to_disk_stamp(&fe->modificationTime, inode_get_mtime(inode)); udf_time_to_disk_stamp(&fe->attrTime, inode_get_ctime(inode)); memset(&(fe->impIdent), 0, sizeof(struct regid)); - strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); + strscpy(fe->impIdent.ident, UDF_ID_DEVELOPER, sizeof(fe->impIdent.ident)); fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; fe->uniqueID = cpu_to_le64(iinfo->i_unique); @@ -1872,7 +1872,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) udf_time_to_disk_stamp(&efe->attrTime, inode_get_ctime(inode)); memset(&(efe->impIdent), 0, sizeof(efe->impIdent)); - strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); + strscpy(efe->impIdent.ident, UDF_ID_DEVELOPER, sizeof(efe->impIdent.ident)); efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; efe->uniqueID = cpu_to_le64(iinfo->i_unique); -- 2.54.0