Skip to content

Commit

Permalink
Merge pull request #460 from rhenium/ky/pkey-ec-verify-overflow
Browse files Browse the repository at this point in the history
pkey: use RSTRING_LENINT() instead of casting to int
  • Loading branch information
rhenium committed Sep 28, 2021
2 parents a9d7195 + b8eed2b commit 6880dba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ext/openssl/ossl_pkey_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,15 @@ static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig)
StringValue(data);
StringValue(sig);

switch (ECDSA_verify(0, (unsigned char *) RSTRING_PTR(data), RSTRING_LENINT(data), (unsigned char *) RSTRING_PTR(sig), (int)RSTRING_LEN(sig), ec)) {
case 1: return Qtrue;
case 0: return Qfalse;
default: break;
switch (ECDSA_verify(0, (unsigned char *)RSTRING_PTR(data), RSTRING_LENINT(data),
(unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), ec)) {
case 1:
return Qtrue;
case 0:
return Qfalse;
default:
ossl_raise(eECError, "ECDSA_verify");
}

ossl_raise(eECError, "ECDSA_verify");

UNREACHABLE;
}

/*
Expand Down

0 comments on commit 6880dba

Please sign in to comment.