Skip to content

Commit 97c0a34

Browse files
cjihrigZYSzys
authored andcommitted
src: don't point to out of scope variable
Coverity reported this. The addr pointer is passed to req_wrap->Dispatch(). By the time this happens, the value that addr points to, addr_storage, is out of scope. This commit remedies that. PR-URL: #27070 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent 77dee25 commit 97c0a34

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/udp_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,9 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
451451
req_wrap->msg_size = msg_size;
452452

453453
int err = 0;
454+
struct sockaddr_storage addr_storage;
454455
sockaddr* addr = nullptr;
455456
if (sendto) {
456-
struct sockaddr_storage addr_storage;
457457
const unsigned short port = args[3].As<Uint32>()->Value();
458458
node::Utf8Value address(env->isolate(), args[4]);
459459
err = sockaddr_for_family(family, address.out(), port, &addr_storage);

0 commit comments

Comments
 (0)