src: use sizeof(var) instead of sizeof(type) · nodejs/node@32ec034 (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Commit 32ec034
authored and
committed
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: #27038Reviewed-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
File tree
1 file changed
lines changed
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1969,7 +1969,7 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { | ||
1969 | 1969 | args[4]->IsTrue()); |
1970 | 1970 | |
1971 | 1971 | struct addrinfo hints; |
1972 | -memset(&hints, 0, sizeof(struct addrinfo)); | |
1972 | +memset(&hints, 0, sizeof(hints)); | |
1973 | 1973 | hints.ai_family = family; |
1974 | 1974 | hints.ai_socktype = SOCK_STREAM; |
1975 | 1975 | hints.ai_flags = flags; |