Skip to content

Commit a21bee7

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 <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Signed-off-by: Beth Griggs <[email protected]>
1 parent 2f1da92 commit a21bee7

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)