Skip to content

Commit

Permalink
src: fix time-of-use vs time-of-check "bugs"
Browse files Browse the repository at this point in the history
Refs: #40128

PR-URL: #40128
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
kokke authored and targos committed Oct 4, 2021
1 parent e040f2c commit a6112dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/crypto/crypto_context.cc
Expand Up @@ -1114,7 +1114,7 @@ int SecureContext::TicketKeyCallback(SSL* ssl,
return -1;
}

argv[2] = env != 0 ? v8::True(env->isolate()) : v8::False(env->isolate());
argv[2] = v8::True(env->isolate());

Local<Value> ret;
if (!node::MakeCallback(
Expand Down
6 changes: 5 additions & 1 deletion src/udp_wrap.cc
Expand Up @@ -371,13 +371,17 @@ void UDPWrap::Disconnect(const FunctionCallbackInfo<Value>& args) {
#define X(name, fn) \
void UDPWrap::name(const FunctionCallbackInfo<Value>& args) { \
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder()); \
if (wrap == nullptr) { \
args.GetReturnValue().Set(UV_EBADF); \
return; \
} \
Environment* env = wrap->env(); \
CHECK_EQ(args.Length(), 1); \
int flag; \
if (!args[0]->Int32Value(env->context()).To(&flag)) { \
return; \
} \
int err = wrap == nullptr ? UV_EBADF : fn(&wrap->handle_, flag); \
int err = fn(&wrap->handle_, flag); \
args.GetReturnValue().Set(err); \
}

Expand Down

0 comments on commit a6112dd

Please sign in to comment.