mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
parent
24ad7e72c8
commit
74356c9737
@ -168,6 +168,11 @@ int dns_msg_parse_reply(const uint8_t *buf, size_t len, int family,
|
||||
bufpos += RR_TTL_LENGTH;
|
||||
|
||||
unsigned addrlen = ntohs(_get_short(bufpos));
|
||||
bufpos += RR_RDLENGTH_LENGTH;
|
||||
if ((bufpos + addrlen) > buflim) {
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
/* skip unwanted answers */
|
||||
if ((class != DNS_CLASS_IN) ||
|
||||
((_type == DNS_TYPE_A) && (family == AF_INET6)) ||
|
||||
@ -189,10 +194,6 @@ int dns_msg_parse_reply(const uint8_t *buf, size_t len, int family,
|
||||
(family == AF_UNSPEC))) {
|
||||
return -EBADMSG;
|
||||
}
|
||||
bufpos += RR_RDLENGTH_LENGTH;
|
||||
if ((bufpos + addrlen) > buflim) {
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
memcpy(addr_out, bufpos, addrlen);
|
||||
return addrlen;
|
||||
|
Loading…
Reference in New Issue
Block a user