Skip to content

Commit 32ec034

Browse files
bnoordhuisBethGriggs
authored andcommitted
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: #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>
1 parent 100bfc5 commit 32ec034

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cares_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,7 @@ void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
19691969
args[4]->IsTrue());
19701970

19711971
struct addrinfo hints;
1972-
memset(&hints, 0, sizeof(struct addrinfo));
1972+
memset(&hints, 0, sizeof(hints));
19731973
hints.ai_family = family;
19741974
hints.ai_socktype = SOCK_STREAM;
19751975
hints.ai_flags = flags;

0 commit comments

Comments
 (0)