mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
src: check for empty maybe local
Using ToLocalChecked on MaybeLocal without verifying it's empty can lead to unattempted crash. PR-URL: https://github.com/nodejs/node/pull/32339 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
1b1c2993a5
commit
191fb3c2f2
@ -516,7 +516,8 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
|
||||
|
||||
// construct uv_buf_t array
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
Local<Value> chunk = chunks->Get(env->context(), i).ToLocalChecked();
|
||||
Local<Value> chunk;
|
||||
if (!chunks->Get(env->context(), i).ToLocal(&chunk)) return;
|
||||
|
||||
size_t length = Buffer::Length(chunk);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user