Skip to content

Commit

Permalink
[Minor] Rdns: One more sanity check added
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Aug 23, 2021
1 parent 2d107f5 commit c96b4fc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion contrib/librdns/parse.c
Expand Up @@ -370,6 +370,16 @@ rdns_parse_rr (struct rdns_resolver *resolver,
*remain -= txtlen + 1;
}
else {

if (txtlen + copied + parts > datalen) {
/* Incorrect datalen reported ! */
rdns_err ("incorrect txtlen (%d) > datalen (%d) reported; domain %s",
(txtlen + copied + parts), datalen,
rep->requested_name);
return -1;
}

/* Reported equal to the actual data copied */
break;
}
}
Expand Down Expand Up @@ -425,7 +435,7 @@ rdns_parse_rr (struct rdns_resolver *resolver,
*remain -= datalen;
break;
default:
rdns_debug ("unexpected RR type: %d; domain %s", type, rep->requested_name);
rdns_info ("unexpected RR type: %d; domain %s", type, rep->requested_name);
p += datalen;
*remain -= datalen;
break;
Expand Down

0 comments on commit c96b4fc

Please sign in to comment.