summaryrefslogtreecommitdiff
path: root/ares_parse_srv_reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares_parse_srv_reply.c')
-rw-r--r--ares_parse_srv_reply.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ares_parse_srv_reply.c b/ares_parse_srv_reply.c
index 9c7eb6e..0739c27 100644
--- a/ares_parse_srv_reply.c
+++ b/ares_parse_srv_reply.c
@@ -17,9 +17,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
@@ -38,8 +35,6 @@
# include <arpa/nameser_compat.h>
#endif
-#include <stdlib.h>
-#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_data.h"
@@ -110,6 +105,11 @@ ares_parse_srv_reply (const unsigned char *abuf, int alen,
rr_class = DNS_RR_CLASS (aptr);
rr_len = DNS_RR_LEN (aptr);
aptr += RRFIXEDSZ;
+ if (aptr + rr_len > abuf + alen)
+ {
+ status = ARES_EBADRESP;
+ break;
+ }
/* Check if we are really looking at a SRV record */
if (rr_class == C_IN && rr_type == T_SRV)