summaryrefslogtreecommitdiff
path: root/ares_parse_ns_reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'ares_parse_ns_reply.c')
-rw-r--r--ares_parse_ns_reply.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ares_parse_ns_reply.c b/ares_parse_ns_reply.c
index 553f253..d331e67 100644
--- a/ares_parse_ns_reply.c
+++ b/ares_parse_ns_reply.c
@@ -105,6 +105,12 @@ int ares_parse_ns_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)
+ {
+ free(rr_name);
+ status = ARES_EBADRESP;
+ break;
+ }
if ( rr_class == C_IN && rr_type == T_NS )
{