From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92FE430170C for ; Sat, 13 Dec 2025 11:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765623946; cv=none; b=VxnsNoUoaF7Kgo/IvYCyjev2y+tTgytBcw1/90ek4NrgQ7kd3VmsvlXoAMaIrpeeiCeJ/RCRCdtlsPV09/WCiL39Vrzafir+tKmePkr+19crKKlGf1el928NOKRRW1/QfJXECcaTkeD9aiP0NpB9w8vKXg+eeRNwA8wOZXQ7Phw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765623946; c=relaxed/simple; bh=VUUdqA+upTDv0a3onX2emVj/tWFz0fZKrLN1jwBVgMA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VtMpA8K2YvCLDV/B+LJ3nRR0Nb+hmAfpcRy5hw734U4n569YAs64cB8KY6CdOiNWQ4iafJuyIojnpaY6xh0ooQ41/3mgYHEQ6VY863mf6reg8axnqeNloKyrW8TC7ZMPX1aocC/s80IVp0M0ABJxXwaqZHxL5eAQZUO6EnTWkns= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aUN6h4SL; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aUN6h4SL" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1765623932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=CzqT5afplxtBn5RX+w8uL8eO3ABobtzcr498eIMhBdE=; b=aUN6h4SLOjLRftrJuHwtDq7gi+CxqpS4ZQ3pSY53FCFmEzu5z86rgCjuxYEq9g54b0k82g IutTyanx5jqof6Sbj6PedtfIinlkWD/xrVMSTa7xBB6p4a/MUaz5bodm0fPgo3gT1eNF/a sa1rv9lXpcOkMWpFDBKhcZqS08hQO6U= From: Thorsten Blum To: Tyler Hicks , Ard Biesheuvel , Christian Brauner , Eric Biggers Cc: Thorsten Blum , ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] ecryptfs: Replace strcpy with strscpy in ecryptfs_set_default_crypt_stat_vals Date: Sat, 13 Dec 2025 12:04:50 +0100 Message-ID: <20251213110502.302950-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT strcpy() has been deprecated [1] because it performs no bounds checking on the destination buffer, which can lead to buffer overflows. Replace it with the safer strscpy(). Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1] Signed-off-by: Thorsten Blum --- fs/ecryptfs/crypto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 69536cacdea8..2c37ee6a8be1 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -717,7 +718,7 @@ static void ecryptfs_set_default_crypt_stat_vals( ecryptfs_copy_mount_wide_flags_to_inode_flags(crypt_stat, mount_crypt_stat); ecryptfs_set_default_sizes(crypt_stat); - strcpy(crypt_stat->cipher, ECRYPTFS_DEFAULT_CIPHER); + strscpy(crypt_stat->cipher, ECRYPTFS_DEFAULT_CIPHER); crypt_stat->key_size = ECRYPTFS_DEFAULT_KEY_BYTES; crypt_stat->flags &= ~(ECRYPTFS_KEY_VALID); crypt_stat->file_version = ECRYPTFS_FILE_VERSION; -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4