fixed a dns packet check issue in dns.c

This commit is contained in:
hyung-hwan 2020-02-19 15:42:29 +00:00
parent 73eff3822b
commit c5e8e902aa

View File

@ -821,6 +821,7 @@ static int parse_answer_rr (mio_t* mio, mio_dns_rr_part_t rr_part, mio_oow_t pos
soa->rname = (mio_bch_t*)pi->_rrdptr;
if (parse_domain_name(mio, pi) <= -1) goto oops;
if (MIO_UNLIKELY(pi->_end - pi->_ptr) < 20) goto oops;
MIO_MEMCPY (&soa->serial, pi->_ptr, 20);
soa->serial = mio_ntoh32(soa->serial);
soa->refresh = mio_ntoh32(soa->refresh);
@ -832,8 +833,8 @@ static int parse_answer_rr (mio_t* mio, mio_dns_rr_part_t rr_part, mio_oow_t pos
{
if (parse_domain_name(mio, pi) <= -1) goto oops;
if (parse_domain_name(mio, pi) <= -1) goto oops;
}
if (MIO_UNLIKELY(pi->_end - pi->_ptr) < 20) goto oops;
}
pi->_ptr += 20;
MIO_ASSERT (mio, pi->_ptr == xptr + dlen);