]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix potential memory leak in OSSL_IETF_ATTR_SYNTAX_add1_value()
authorsashan <anedvedicky@gmail.com>
Wed, 22 May 2024 04:40:41 +0000 (06:40 +0200)
committerTomas Mraz <tomas@openssl.org>
Thu, 30 May 2024 16:34:22 +0000 (18:34 +0200)
The function may leak memory if it deals with an unknown type.
Issue reported by LuMingYinDetect.

Fixes #24452

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24454)

crypto/x509/x_ietfatt.c

index 08db0bafc720048d7e5172dc57234e995bf81850..14197602805c5d2bc29c22e2b8356ed08a0c0d0a 100644 (file)
@@ -174,6 +174,7 @@ int OSSL_IETF_ATTR_SYNTAX_add1_value(OSSL_IETF_ATTR_SYNTAX *a, int type,
         val->u.string = data;
         break;
     default:
+        OSSL_IETF_ATTR_SYNTAX_VALUE_free(val);
         ERR_raise(ERR_LIB_X509V3, ERR_R_PASSED_INVALID_ARGUMENT);
         return 0;
     }