diff --git a/include/nuttx/net/dns.h b/include/nuttx/net/dns.h index 8c11147e7ed..b9f0cb955a2 100644 --- a/include/nuttx/net/dns.h +++ b/include/nuttx/net/dns.h @@ -56,14 +56,14 @@ /* DNS classes */ #define DNS_CLASS_IN 1 /* RFC 1035 Internet */ -#define DNS_CLASS CH 3 /* N/A Chaos */ +#define DNS_CLASS_CH 3 /* N/A Chaos */ #define DNS_CLASS_HS 4 /* N/A Hesiod */ #define DNS_CLASS_QNONE 254 /* RFC 2136 QCLASS NONE */ #define DNS_CLASS_QANY 255 /* RFC 1035 QCLASS ANY */ /* DNS resource record types */ -#define DNS_RECTYPE_A 1 /* RFC 1035 IPv4 ddress record */ +#define DNS_RECTYPE_A 1 /* RFC 1035 IPv4 address record */ #define DNS_RECTYPE_AAAA 28 /* RFC 3596 IPv6 address record */ #define DNS_RECTYPE_AFSDB 18 /* RFC 1183 AFS database record */ #define DNS_RECTYPE_APL 42 /* RFC 3123 Address Prefix List */ diff --git a/libc/netdb/lib_dnsquery.c b/libc/netdb/lib_dnsquery.c index 117cc0926a0..0da2ebfc976 100644 --- a/libc/netdb/lib_dnsquery.c +++ b/libc/netdb/lib_dnsquery.c @@ -393,7 +393,7 @@ static int dns_recv_response(int sd, FAR struct sockaddr *addr, if (ans->type == HTONS(DNS_RECTYPE_A) && ans->class == HTONS(DNS_CLASS_IN) && ans->len == HTONS(4) && - nameptr + 10 + 4 < endofbuffer) + nameptr + 10 + 4 <= endofbuffer) { ans->u.ipv4.s_addr = *(FAR uint32_t *)(nameptr + 10); @@ -426,7 +426,7 @@ static int dns_recv_response(int sd, FAR struct sockaddr *addr, if (ans->type == HTONS(DNS_RECTYPE_AAAA) && ans->class == HTONS(DNS_CLASS_IN) && ans->len == HTONS(16) && - nameptr + 10 + 16 < endofbuffer) + nameptr + 10 + 16 <= endofbuffer) { memcpy(&ans->u.ipv6.s6_addr, nameptr + 10, 16);