- Fix Insufficient Handling of Compressed Names in dname_pkt_copy(),

reported by X41 D-Sec.
This commit is contained in:
W.C.A. Wijngaards 2019-12-03 16:17:03 +01:00
parent c99438c6a1
commit 2d444a5037
2 changed files with 8 additions and 0 deletions

View file

@ -15,6 +15,8 @@
- Fix Out of Bounds Write in sldns_b64_pton(),
fixed by check in sldns_str2wire_int16_data_buf(),
reported by X41 D-Sec.
- Fix Insufficient Handling of Compressed Names in dname_pkt_copy(),
reported by X41 D-Sec.
2 December 2019: Wouter
- Merge pull request #122 from he32: In tcp_callback_writer(),

View file

@ -329,11 +329,17 @@ dname_pkt_hash(sldns_buffer* pkt, uint8_t* dname, hashvalue_type h)
void dname_pkt_copy(sldns_buffer* pkt, uint8_t* to, uint8_t* dname)
{
/* copy over the dname and decompress it at the same time */
size_t comprcount = 0;
size_t len = 0;
uint8_t lablen;
lablen = *dname++;
while(lablen) {
if(LABEL_IS_PTR(lablen)) {
if(comprcount++ > MAX_COMPRESS_PTRS) {
/* too many compression pointers */
*to = 0; /* end the result prematurely */
return;
}
/* follow pointer */
dname = sldns_buffer_at(pkt, PTR_OFFSET(lablen, *dname));
lablen = *dname++;