summaryrefslogtreecommitdiff
path: root/ares_parse_a_reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares_parse_a_reply.c')
-rw-r--r--ares_parse_a_reply.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ares_parse_a_reply.c b/ares_parse_a_reply.c
index 4bd0845..a3ed69e 100644
--- a/ares_parse_a_reply.c
+++ b/ares_parse_a_reply.c
@@ -16,9 +16,6 @@
#include "ares_setup.h"
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
@@ -41,8 +38,6 @@
# include <strings.h>
#endif
-#include <stdlib.h>
-#include <string.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
@@ -141,6 +136,12 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
rr_len = DNS_RR_LEN(aptr);
rr_ttl = DNS_RR_TTL(aptr);
aptr += RRFIXEDSZ;
+ if (aptr + rr_len > abuf + alen)
+ {
+ free(rr_name);
+ status = ARES_EBADRESP;
+ break;
+ }
if (rr_class == C_IN && rr_type == T_A
&& rr_len == sizeof(struct in_addr)