Skip to content

Commit

Permalink
misc: individual memsets to avoid report of out of bounds access by s…
Browse files Browse the repository at this point in the history
…tatic analysis (#39)

MIN-9256

Co-authored-by: seth <Seth Hager>
  • Loading branch information
SethHager authored Aug 10, 2021
1 parent 07267da commit 42e14a2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/unum/util/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -7060,7 +7060,18 @@ void dns_res_reset(struct dns_resolver *R) {
for (i = 0; i < lengthof(R->stack); i++)
dns_res_frame_destroy(R, &R->stack[i]);

memset(&R->qname, '\0', sizeof *R - offsetof(struct dns_resolver, qname));
// individual memsets to avoid report of out of bounds access
// by static analysis
memset(&R->qname, '\0', sizeof(R->qname));
memset(&R->qlen, '\0', sizeof(R->qlen));
memset(&R->qtype, '\0', sizeof(R->qtype));
memset(&R->qclass, '\0', sizeof(R->qclass));
memset(&R->elapsed, '\0', sizeof(R->elapsed));
memset(&R->search, '\0', sizeof(R->search));
memset(&R->smart, '\0', sizeof(R->smart));
memset(&R->nodata, '\0', sizeof(R->nodata));
memset(&R->sp, '\0', sizeof(R->sp));
memset(&R->stack, '\0', sizeof(R->stack));

for (i = 0; i < lengthof(R->stack); i++)
dns_res_frame_init(R, &R->stack[i]);
Expand Down

0 comments on commit 42e14a2

Please sign in to comment.