Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
cjihrig committed Apr 3, 2019
commit 4a7f5710ea3bdc22383fd373c1a40f25956329bf
2 changes: 1 addition & 1 deletion src/udp_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
req_wrap->msg_size = msg_size;

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