linux/drivers/crypto/marvell
Thorsten Blum 62c89e1992 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:19:44 +01:00
..
cesa crypto: marvell/cesa - Fix engine load inaccuracy 2025-06-13 17:26:16 +08:00
octeontx crypto: octeontx - Fix length check to avoid truncation in ucode_load_store 2026-02-16 10:19:44 +01:00
octeontx2 crypto: octeontx2 - Call strscpy() with correct size argument 2025-08-22 17:28:44 +08:00
Kconfig crypto: lib/Kconfig - hide library options 2025-03-21 17:33:39 +08:00
Makefile crypto: marvell - add Marvell OcteonTX2 CPT PF driver 2021-01-22 14:58:02 +11:00