Skip to content

Commit

Permalink
rr_read_TXT: Fix potential integer underflow leading to OOB read
Browse files Browse the repository at this point in the history
  • Loading branch information
chouquette committed Mar 19, 2020
1 parent 0f5b814 commit f0e8a72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ rr_read_TXT(const uint8_t *ptr, size_t *n, const uint8_t *root, struct rr_entry
if (*n == 0 || *n < len)
return (NULL);

for (; len > 0; len -= l + 1) {
for (; len > 0 && *n > 0; len -= l + 1) {
struct rr_data_txt *text;

memcpy(&l, ptr, sizeof(l));
Expand Down

0 comments on commit f0e8a72

Please sign in to comment.