]> git.ipfire.org Git - thirdparty/knot-resolver.git/commit
lib/utils: fixed memory corruption in kr_pkt_recycle and kr_pkt_clear_payload
authorMarek Vavruša <marek@vavrusa.com>
Fri, 16 Mar 2018 02:27:59 +0000 (19:27 -0700)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 23 Apr 2018 12:34:40 +0000 (14:34 +0200)
commitc4037c24892168fe8bdf52f76efa6532c731ddc9
treeee9073a680da4d06898290d7c83317b394f5e1ab
parent096f2d96f519f039cb8cd467f30b60c8df150e16
lib/utils: fixed memory corruption in kr_pkt_recycle and kr_pkt_clear_payload

Previous implementation forgot to clear the compression table, which is
an internal structure to packet. So when a recycled packet was reused,
it compared owners of newly inserted records with dangling pointers left
in the compression table.

This is less of a problem in query processing,
as each packet uses a memory pool, so the pointed names were never deallocated,
but it would write out wrong compression pointers because the compression
table kept pointing into packet that was now cleared and reused for something else.

It is more of a problem with packets created without a memory pool,
as the compression table kept references to memory that was already freed.
lib/utils.c