diff options
author | Matteo Collina <hello@matteocollina.com> | 2016-05-17 12:36:54 +0200 |
---|---|---|
committer | Matteo Collina <hello@matteocollina.com> | 2016-05-26 11:28:45 +0200 |
commit | c14e98b476156487024254fe391512ae95e642e6 (patch) | |
tree | ec347be28eafb9cb8f30a52d4ca66d074fe5dc32 /src/udp_wrap.cc | |
parent | f9ea52e5ebebf4ad7058ff1d950c63ae18a7a3da (diff) | |
download | node-new-c14e98b476156487024254fe391512ae95e642e6.tar.gz |
dgram: copy the list in send
This commit fix a possible crash situation in dgram send().
A crash is possible if an array is passed, and then altered after the
send call, as the call to libuv is wrapped in process.nextTick().
It also avoid sending an empty array to libuv by allocating an empty
buffer. It also does some cleanup inside send() to increase readability.
It removes test flakyness by use common.mustCall and
common.platformTimeout. Fixes situations were some events were not
asserted to be emitted.
Fixes: https://github.com/nodejs/node/issues/6616
PR-URL: https://github.com/nodejs/node/pull/6804
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/udp_wrap.cc')
-rw-r--r-- | src/udp_wrap.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index be141a672c..bd7aa418bd 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -257,7 +257,7 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) { args.Holder(), args.GetReturnValue().Set(UV_EBADF)); - // send(req, buffer, port, address, hasCallback) + // send(req, list, port, address, hasCallback) CHECK(args[0]->IsObject()); CHECK(args[1]->IsArray()); CHECK(args[2]->IsUint32()); |