Skip to content

Commit 60538e0

Browse files
committed
Fix NULL ptr dereference on EC_POINT *point
Use non-usual params of pkcs11 module will trigger a null ptr deref bug. Fix it for openssl#25493 CLA: trivial
1 parent daead12 commit 60538e0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

crypto/ec/ec_asn1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ int i2o_ECPublicKey(const EC_KEY *a, unsigned char **out)
11561156
size_t buf_len = 0;
11571157
int new_buffer = 0;
11581158

1159-
if (a == NULL) {
1159+
if (a == NULL || a->pub_key == NULL) {
11601160
ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
11611161
return 0;
11621162
}

crypto/ec/ec_oct.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
7474
point_conversion_form_t form, unsigned char *buf,
7575
size_t len, BN_CTX *ctx)
7676
{
77+
if (point == NULL) {
78+
ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
79+
return 0;
80+
}
7781
if (group->meth->point2oct == 0
7882
&& !(group->meth->flags & EC_FLAGS_DEFAULT_OCT)) {
7983
ERR_raise(ERR_LIB_EC, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);

0 commit comments

Comments
 (0)