Skip to content

Commit a6112dd

Browse files
kokketargos
authored andcommitted
src: fix time-of-use vs time-of-check "bugs"
Refs: #40128 PR-URL: #40128 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e040f2c commit a6112dd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/crypto/crypto_context.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ int SecureContext::TicketKeyCallback(SSL* ssl,
11141114
return -1;
11151115
}
11161116

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

11191119
Local<Value> ret;
11201120
if (!node::MakeCallback(

src/udp_wrap.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,17 @@ void UDPWrap::Disconnect(const FunctionCallbackInfo<Value>& args) {
371371
#define X(name, fn) \
372372
void UDPWrap::name(const FunctionCallbackInfo<Value>& args) { \
373373
UDPWrap* wrap = Unwrap<UDPWrap>(args.Holder()); \
374+
if (wrap == nullptr) { \
375+
args.GetReturnValue().Set(UV_EBADF); \
376+
return; \
377+
} \
374378
Environment* env = wrap->env(); \
375379
CHECK_EQ(args.Length(), 1); \
376380
int flag; \
377381
if (!args[0]->Int32Value(env->context()).To(&flag)) { \
378382
return; \
379383
} \
380-
int err = wrap == nullptr ? UV_EBADF : fn(&wrap->handle_, flag); \
384+
int err = fn(&wrap->handle_, flag); \
381385
args.GetReturnValue().Set(err); \
382386
}
383387

0 commit comments

Comments
 (0)