]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
INSIST that openssleddsa_alg_info() is successful
authorAram Sargsyan <aram@isc.org>
Tue, 4 Apr 2023 12:34:35 +0000 (12:34 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Wed, 5 Apr 2023 08:03:43 +0000 (08:03 +0000)
In the check_algorithm() function openssleddsa_alg_info() is
called with two known variants of the 'algorithm' argument, and
both are expected to return a non-NULL value.

Add an INSIST to suppress the following GCC 12 analyzer report:

    openssleddsa_link.c: In function 'raw_key_to_ossl':
    openssleddsa_link.c:92:13: error: dereference of NULL 'alginfo' [CWE-476] [-Werror=analyzer-null-dereference]
       92 |         int pkey_type = alginfo->pkey_type;
          |             ^~~~~~~~~

lib/dns/openssleddsa_link.c

index a547ac37d4e34f31220eeb9489eff0782e6af311..142aa1623aac42d4faae9c94bece3c1ba5080685 100644 (file)
@@ -633,6 +633,7 @@ check_algorithm(unsigned char algorithm) {
                DST_RET(ISC_R_NOTIMPLEMENTED);
        }
 
+       INSIST(alginfo != NULL);
        ret = raw_key_to_ossl(alginfo, 0, key, &key_len, &pkey);
        if (ret != ISC_R_SUCCESS) {
                goto err;