From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 ABAD423B63F for ; Thu, 9 Oct 2025 18:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760033242; cv=none; b=IdAArMbc8WFBacaRmH6vOhjm1cD/4CCjUv0uEmOYMiz1mMQdUPDcv2rabfbYVmNgeSACm1xPDENh2Gys/7QkWScn+yGJ6zTA4kpCIvpzxUAfEyaQuLPxtMEjbdRAo2qK8GKEij6atsTYVXC63L2ZIyjkFPRo28899CRoJ65ZzzM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760033242; c=relaxed/simple; bh=+XROxS/6axodpUAsRfm1JbYQuQXZCNtj0a3EoWZH/LM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pLbmdhIYLZVMTA7SewGWMShX4NopjzWdry/wJWnygWZqtz93/SJVcFDE3jmpmDEhLBayrEPjp47rjnRLJSu+U2JaIfA0LWQPo7D079t1urY0Pi+LrFtqRQFJ5i1L9jurSRfHQHNmQRGkhAnr8yPdzekUbKAMJk9lLi4RMiLWG4s= 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=XdrslLBy; arc=none smtp.client-ip=91.218.175.173 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="XdrslLBy" 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=1760033225; 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=EwX0KL5LDLB0rYQfiUxmeS4R3P9DgIfWZ4jyJPaAZqI=; b=XdrslLByArftI55uoHmsSsnxNGGLi5UoQYq8vD1LR5CnQyBNPnLFwO13gqjf+AOI8lRdga 1d+Q51nchqY2H4fYdTtKlxmAoIdfoNXrELZiCZUAOTIa4N4mCwl5l4LNtaaPEnfjztUmus tn1Am2ibCPJWaqbFRMY9sI9pqk+SskQ= From: Thorsten Blum To: Mimi Zohar , David Howells , Jarkko Sakkinen , Paul Moore , James Morris , "Serge E. Hallyn" Cc: linux-hardening@vger.kernel.org, Thorsten Blum , linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] keys: Replace deprecated strncpy in ecryptfs_fill_auth_tok Date: Thu, 9 Oct 2025 20:03:17 +0200 Message-ID: <20251009180316.394708-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT strncpy() is deprecated for NUL-terminated destination buffers; use strscpy_pad() instead. Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Thorsten Blum --- security/keys/encrypted-keys/ecryptfs_format.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/security/keys/encrypted-keys/ecryptfs_format.c b/security/keys/encrypted-keys/ecryptfs_format.c index 8fdd76105ce3..2fc6f3a66135 100644 --- a/security/keys/encrypted-keys/ecryptfs_format.c +++ b/security/keys/encrypted-keys/ecryptfs_format.c @@ -54,8 +54,7 @@ int ecryptfs_fill_auth_tok(struct ecryptfs_auth_tok *auth_tok, auth_tok->version = (((uint16_t)(major << 8) & 0xFF00) | ((uint16_t)minor & 0x00FF)); auth_tok->token_type = ECRYPTFS_PASSWORD; - strncpy((char *)auth_tok->token.password.signature, key_desc, - ECRYPTFS_PASSWORD_SIG_SIZE); + strscpy_pad(auth_tok->token.password.signature, key_desc); auth_tok->token.password.session_key_encryption_key_bytes = ECRYPTFS_MAX_KEY_BYTES; /* -- 2.51.0