]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
LMS Coverity fix 1659009
authorslontis <shane.lontis@oracle.com>
Mon, 14 Jul 2025 01:01:41 +0000 (11:01 +1000)
committerNeil Horman <nhorman@openssl.org>
Tue, 15 Jul 2025 11:53:24 +0000 (07:53 -0400)
Fix deref after free.

If ctx->key is already set and the passed in key is NULL then ctx->key
should not be set to NULL.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28030)

providers/implementations/signature/lms_signature.c

index 41a1fdc372dd5da4f45712f47eecbd67db6454ef..7cc2ffa3cca189f2d461362796c9ae7661e7f8c5 100644 (file)
@@ -97,7 +97,8 @@ static int lms_verify_msg_init(void *vctx, void *vkey, const OSSL_PARAM params[]
         ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET);
         return 0;
     }
-    ctx->key = key;
+    if (key != NULL)
+        ctx->key = key;
     return setdigest(ctx, NULL);
 }