Skip to content

Commit 5eaa591

Browse files
tniessendanielleadams
authored andcommitted
src: check return value of HMAC_Final
PR-URL: #42303 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent 7636370 commit 5eaa591

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/crypto/crypto_hmac.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) {
124124
unsigned int md_len = 0;
125125

126126
if (hmac->ctx_) {
127-
HMAC_Final(hmac->ctx_.get(), md_value, &md_len);
127+
bool ok = HMAC_Final(hmac->ctx_.get(), md_value, &md_len);
128128
hmac->ctx_.reset();
129+
if (!ok) {
130+
return ThrowCryptoError(env, ERR_get_error(), "Failed to finalize HMAC");
131+
}
129132
}
130133

131134
Local<Value> error;

0 commit comments

Comments
 (0)