Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2019-04-01 11:45:53 +0300
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-04-04 11:12:48 +0300
commitadbcda1eef4377c6fd0c88a1df1003e1e100ffbe (patch)
treeffbdf58beff60d177f254e9439785c395cc88b80 /src/cares_wrap.cc
parentbe45224f2209e5b36f7c1a36bf43a12a48f2c129 (diff)
src: use sizeof(var) instead of sizeof(type)
Change `memset(&s, 0, sizeof(type))` to `memset(&s, 0, sizeof(s))`. The former is dangerous when the type of `s` changes. PR-URL: https://github.com/nodejs/node/pull/27038 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'src/cares_wrap.cc')
-rw-r--r--src/cares_wrap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index aeb525b33e7..6c6fca53312 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -1969,7 +1969,7 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
args[4]->IsTrue());
struct addrinfo hints;
- memset(&hints, 0, sizeof(struct addrinfo));
+ memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = flags;