mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
crypto: add missing null check
Add null check before using result of ERR_reason_error_string. Coverity reported as an issue and we seem to do a null check in other places we call the function. Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/40598 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
1 parent
93ea1666f6
commit
c757fa513e
1 file changed
+2
@@ -1037,6 +1037,8 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
|
||||
// TODO(@jasnell): Should this use ThrowCryptoError?
|
||||
unsigned long err = ERR_get_error(); // NOLINT(runtime/int)
|
||||
const char* str = ERR_reason_error_string(err);
|
||||
str = str != nullptr ? str : "Unknown error";
|
||||
|
||||
return env->ThrowError(str);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user