Skip to content

Commit f912c2d

Browse files
committed
Fix memory leak in store_public_ec_key
1 parent d0bf032 commit f912c2d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/scitokens_internal.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -949,12 +949,12 @@ bool scitokens::Validator::store_public_ec_key(const std::string &issuer,
949949
"Unable to get OpenSSL public key parameters");
950950
}
951951

952-
void *buf = NULL;
953-
size_t buf_len, max_len = 256;
952+
const void *buf = NULL;
953+
size_t buf_len;
954954
OSSL_PARAM *p = OSSL_PARAM_locate(params, "pub");
955-
if (!p || !OSSL_PARAM_get_octet_string(p, &buf, max_len, &buf_len) ||
955+
if (!p || !OSSL_PARAM_get_octet_string_ptr(p, &buf, &buf_len) ||
956956
!EC_POINT_oct2point(ec_group.get(), q_point.get(),
957-
static_cast<unsigned char *>(buf), buf_len,
957+
static_cast<const unsigned char *>(buf), buf_len,
958958
nullptr)) {
959959
throw UnsupportedKeyException(
960960
"Failed to to set OpenSSL EC point with public key information");

0 commit comments

Comments
 (0)