]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: resolvers: lower-case labels when converting from/to DNS names
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Oct 2021 05:45:38 +0000 (07:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Oct 2021 07:14:02 +0000 (09:14 +0200)
commit814889c28a3ce1bf0bfe2669d43489feba5b4e91
treedcadc29e3c9eed2c78a1e5fe0336baba77c57e14
parentf480768d31d21e24d3c02f52917a35c81942e95f
MEDIUM: resolvers: lower-case labels when converting from/to DNS names

The whole code relies on performing case-insensitive comparison on
lookups, which is extremely inefficient.

Let's make sure that all labels to be looked up or sent are first
converted to lower case. Doing so is also the opportunity to eliminate
an inefficient memcpy() in resolv_dn_label_to_str() that essentially
runs over a few unaligned bytes at once. As a side note, that call
was dangerous because it relied on a sign-extended size taken from a
string that had to be sanitized first.

This is tagged medium because while this is 100% safe, it may cause
visible changes on the wire at the packet level and trigger bugs in
test programs.
src/resolvers.c