From 797a6c43a0e7095f761a048fbf26c0f12d149acf Mon Sep 17 00:00:00 2001
From: Marek Vavrusa <marek@vavrusa.com>
Date: Tue, 3 May 2016 17:17:53 -0700
Subject: [PATCH] lib/validate: fixed memory bug

this code used memory pool of source packet instead
of the answer, this could result in invalidated
memory read if the memory occupied by source
packet was rewritten
---
 lib/layer/validate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/layer/validate.c b/lib/layer/validate.c
index e7364ef90..bf5bafaf3 100644
--- a/lib/layer/validate.c
+++ b/lib/layer/validate.c
@@ -484,7 +484,7 @@ static int validate(knot_layer_t *ctx, knot_pkt_t *pkt)
 		const knot_pktsection_t *auth = knot_pkt_section(pkt, KNOT_AUTHORITY);
 		for (unsigned i = 0; i < auth->count; ++i) {
 			const knot_rrset_t *rr = knot_pkt_rr(auth, i);
-			kr_rrarray_add(&req->authority, rr, &pkt->mm);
+			kr_rrarray_add(&req->authority, rr, &req->answer->mm);
 		}
 	}
 
-- 
GitLab