BUG/MEDIUM: resolvers: Really ignore trailing dot in domain names
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 28 Jan 2022 16:47:57 +0000 (17:47 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Wed, 16 Feb 2022 20:25:40 +0000 (21:25 +0100)
commit11fc8f8632d6bf6b71d8dcc505b3fab0d1abf714
tree874c54927b44fccabaef047e9713fc6fa6b6b8e7
parenteed3cab77026bafde5277788580e9b42bdd81df5
BUG/MEDIUM: resolvers: Really ignore trailing dot in domain names

When a string is converted to a domain name label, the trailing dot must be
ignored. In resolv_str_to_dn_label(), there is a test to do so. However, the
trailing dot is not really ignored. The character itself is not copied but
the string index is still moved to the next char. Thus, this trailing dot is
counted in the length of the last encoded part of the domain name. Worst,
because the copy is skipped, a garbage character is included in the domain
name.

This patch should fix the issue #1528. It must be backported as far as 2.0.

(cherry picked from commit 0a82cf4c1662b8ab00036f65b5e3543a9c1a6ff5)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>
src/resolvers.c