diff options
author | tb <> | 2024-04-17 13:50:01 +0000 |
---|---|---|
committer | tb <> | 2024-04-17 13:50:01 +0000 |
commit | 97b98463467c2f87ba7167b1596449256b4805c7 (patch) | |
tree | d95029e6da72a4363ba64378d2b6ee8655a5d312 /src | |
parent | 371c95bd20fe7e9fa658fbe00b43edd117b77336 (diff) | |
download | openbsd-97b98463467c2f87ba7167b1596449256b4805c7.tar.gz openbsd-97b98463467c2f87ba7167b1596449256b4805c7.tar.bz2 openbsd-97b98463467c2f87ba7167b1596449256b4805c7.zip |
Transfer ownership before setting unused bits
This looks like a use after free, but setting the unused bits to 0
can't actually fail.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 9bcda79b3e..1c2b6be87c 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_ameth.c,v 1.55 2024/04/17 13:49:18 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.56 2024/04/17 13:50:01 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -951,10 +951,12 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) | |||
951 | penclen = i2o_ECPublicKey(eckey, &p); | 951 | penclen = i2o_ECPublicKey(eckey, &p); |
952 | if (penclen <= 0) | 952 | if (penclen <= 0) |
953 | goto err; | 953 | goto err; |
954 | |||
954 | ASN1_STRING_set0(pubkey, penc, penclen); | 955 | ASN1_STRING_set0(pubkey, penc, penclen); |
956 | penc = NULL; | ||
957 | |||
955 | if (!asn1_abs_set_unused_bits(pubkey, 0)) | 958 | if (!asn1_abs_set_unused_bits(pubkey, 0)) |
956 | goto err; | 959 | goto err; |
957 | penc = NULL; | ||
958 | 960 | ||
959 | X509_ALGOR_set0(talg, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), | 961 | X509_ALGOR_set0(talg, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), |
960 | V_ASN1_UNDEF, NULL); | 962 | V_ASN1_UNDEF, NULL); |