summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-04-03 10:48:35 -0400
committerZYSzys <zyszys98@gmail.com>2019-04-07 14:13:11 +0800
commit97c0a3493529666e241277b199fca2d4e093121a (patch)
treef1032ed0c04e3d69beb5cc090b399cb5ba8ef391 /src
parent77dee25efd2fb114a56e83a165a97fef22c68316 (diff)
downloadandroid-node-v8-97c0a3493529666e241277b199fca2d4e093121a.tar.gz
android-node-v8-97c0a3493529666e241277b199fca2d4e093121a.tar.bz2
android-node-v8-97c0a3493529666e241277b199fca2d4e093121a.zip
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: https://github.com/nodejs/node/pull/27070 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'src')
-rw-r--r--src/udp_wrap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index c4be8a6068..59df0232fa 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -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);