BUG/MEDIUM: resolvers: Detach query item on response error
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Dec 2021 09:18:08 +0000 (10:18 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 2 Dec 2021 14:26:29 +0000 (15:26 +0100)
commitdb249aa7b802363e1a98c9901e4ecdc35f9025e8
treeafca61c9622c42b4bd43cef4e4754f0d4d8c9b21
parentf0820e7ddcc1d520138f7ea834d741c8328b2ae9
BUG/MEDIUM: resolvers: Detach query item on response error

When a new response is parsed, it is unexpected to have an old query item
still attached to the resolution. And indeed, when the response is parsed
and validated, the query item is detached and used for a last check on its
dname. However, this is only true for a valid response. If an error is
detected, the query is not detached. This leads to undefined behavior (most
probably a crash) on the next response because the first element in the
query list is referencing an old response.

This patch must be backported as far as 2.0.

(cherry picked from commit 80b2e34b18b805d28a9569d8157c7bcf088eef8f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 3d8fa909ca54a5997abdcc46cc7ec50d0048e720)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 67f6af5b75226d122809e1cc369b8116a8127ce8)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/dns.c