Skip to content

Commit

Permalink
Fix coverity issues, CID 471315 and 356192
Browse files Browse the repository at this point in the history
471315, EC_POINTS_new: Reads target of a freed pointer

356192, pkey_dh_derive: Out-of-bounds access to a buffer
  • Loading branch information
dongbeiouba committed Jul 12, 2024
1 parent 8bfdb8b commit 2a0984f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crypto/dh/dh_pmeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {

unsigned char *Z = NULL;
size_t Zlen = 0;
int Zlen = 0;
if (!dctx->kdf_outlen || !dctx->kdf_oid)
return 0;
if (key == NULL) {
Expand Down
4 changes: 3 additions & 1 deletion crypto/ec/ec_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,10 @@ EC_POINTS *EC_POINTS_new(const EC_GROUP *group, int count)

for (i = 0; i < count; i++) {
point = EC_POINT_new(group);
if (point == NULL)
if (point == NULL) {
EC_POINTS_free(ret);
return NULL;
}

ret->items[i] = point;
}
Expand Down

0 comments on commit 2a0984f

Please sign in to comment.