From 1ab75f0ddf85484023a11ffcdd389c865466f574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Thu, 14 Mar 2024 10:01:37 +0100 Subject: [PATCH] Fix dereference before NULL check Coverity CID 379852 --- src/p11_ec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p11_ec.c b/src/p11_ec.c index c44a5dc3..728353f0 100644 --- a/src/p11_ec.c +++ b/src/p11_ec.c @@ -248,10 +248,13 @@ static int pkcs11_get_point(EC_KEY *ec, PKCS11_OBJECT_private *key, CK_SESSION_H ASN1_OCTET_STRING *os; int rv = -1; + if (!key) + return -1; + if (key->x509 && pkcs11_get_point_x509(ec, key->x509) == 0) return 0; - if (!key || pkcs11_getattr_alloc(key->slot->ctx, session, key->object, + if (pkcs11_getattr_alloc(key->slot->ctx, session, key->object, CKA_EC_POINT, &point, &point_len)) return -1;