]> git.ipfire.org Git - thirdparty/u-boot.git/commit
lib: sm3: fix coverity error
authorHeiko Schocher <hs@nabladev.com>
Fri, 23 Jan 2026 02:25:51 +0000 (03:25 +0100)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Wed, 11 Feb 2026 09:13:47 +0000 (11:13 +0200)
commit546687c8dc249447215d091165ed9e820a3f395e
treed4bc5e7baeb7da68f5488b8819cab34370e92063
parent712765339a5c6576fdd5683748f97a1215868d5d
lib: sm3: fix coverity error

Coverity scan reported:

CID 449815:         Memory - illegal accesses  (OVERRUN)
Overrunning array of 64 bytes at byte offset 64 by dereferencing pointer
"sctx->buffer + partial". [Note: The source code implementation of the
function has been overridden by a builtin model.]

In line: 252
   memset(sctx->buffer + partial, 0, SM3_BLOCK_SIZE - partial);

The respective line should be:

memset(sctx->buffer + partial, 0, SM3_BLOCK_SIZE - partial - 1);

as partial gets incremented by one before.

Signed-off-by: Heiko Schocher <hs@nabladev.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/sm3.c