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
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2019-04-10 17:30:30 +0300
commita21bee77efb36eaf32f60616a0c9ec2acfed49d0 (patch)
treef4002e813d196cc5a6cd66550f3a7b60b6c8fb63
parent2f1da9205267e2ce215bff0073ec6d88586c79b5 (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> Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
-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;