linux/drivers/crypto/marvell
Thorsten Blum 1ff337fc7c crypto: octeontx - Fix length check to avoid truncation in ucode_load_store
commit 5565a72b24 upstream.

OTX_CPT_UCODE_NAME_LENGTH limits the microcode name to 64 bytes. If a
user writes a string of exactly 64 characters, the original code used
'strlen(buf) > 64' to check the length, but then strscpy() copies only
63 characters before adding a NUL terminator, silently truncating the
copied string.

Fix this off-by-one error by using 'count' directly for the length check
to ensure long names are rejected early and copied without truncation.

Cc: stable@vger.kernel.org
Fixes: d9110b0b01 ("crypto: marvell - add support for OCTEON TX CPT engine")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-02-16 10:18:44 +01:00
..
cesa crypto: marvell/cesa - Fix engine load inaccuracy 2025-08-15 12:13:49 +02:00
octeontx crypto: octeontx - Fix length check to avoid truncation in ucode_load_store 2026-02-16 10:18:44 +01:00
octeontx2 crypto: octeontx2 - Call strscpy() with correct size argument 2025-10-15 12:00:06 +02:00
Kconfig crypto: octeontx* - Select CRYPTO_AUTHENC 2024-09-06 14:50:46 +08:00
Makefile crypto: marvell - add Marvell OcteonTX2 CPT PF driver 2021-01-22 14:58:02 +11:00