Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request #15345 from nmeum/pr/sock_dns_overflow
sock_dns: Fix incorrect buffer bounds check
  • Loading branch information
miri64 committed Oct 31, 2020
2 parents d046772 + 85296ce commit 44741ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sys/net/application_layer/dns/dns.c
Expand Up @@ -125,7 +125,8 @@ static int _parse_dns_reply(uint8_t *buf, size_t len, void* addr_out, int family
return tmp;
}
bufpos += tmp;
if ((bufpos + RR_TYPE_LENGTH + RR_CLASS_LENGTH + RR_TTL_LENGTH) >= buflim) {
if ((bufpos + RR_TYPE_LENGTH + RR_CLASS_LENGTH +
RR_TTL_LENGTH + sizeof(uint16_t)) >= buflim) {
return -EBADMSG;
}
uint16_t _type = ntohs(_get_short(bufpos));
Expand Down

0 comments on commit 44741ff

Please sign in to comment.