Skip to content

Commit 02bbdfb

Browse files
committed
Assert that the remaining fields are really zeroed
1 parent f4d7669 commit 02bbdfb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

httplib.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3821,6 +3821,10 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,
38213821
state->hints.ai_socktype = hints->ai_socktype;
38223822
state->hints.ai_protocol = hints->ai_protocol;
38233823
// The remaining fields of "hints" must be zeroed, so do not copy them.
3824+
assert(hints->ai_addrlen == 0);
3825+
assert(hints->ai_addr == nullptr);
3826+
assert(hints->ai_canonname == nullptr);
3827+
assert(hints->ai_next == nullptr);
38243828

38253829
std::thread resolve_thread([=]() {
38263830
auto thread_result = getaddrinfo(

0 commit comments

Comments
 (0)