Skip to content

Commit

Permalink
crypto: fix error condition in Verify::VerifyFinal
Browse files Browse the repository at this point in the history
Fail early if key parsing failed, don't try to construct a context out
of it.

PR-URL: nodejs#26238
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
tniessen committed Feb 23, 2019
1 parent 8ebd339 commit 10c3db3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4675,6 +4675,8 @@ void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) {

unsigned int offset = 0;
ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs(args, &offset, true);
if (!pkey)
return;

char* hbuf = Buffer::Data(args[offset]);
ssize_t hlen = Buffer::Length(args[offset]);
Expand Down

0 comments on commit 10c3db3

Please sign in to comment.