mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05: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:
1 parent
13377a0f0f
commit
aa282276ec
1 file changed
+2
-1
+2
-1
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user