BUG/MINOR: dns: ignore trailing dot

As per issue #435 a hostname with a trailing dot confuses our DNS code,
as for a zero length DNS label we emit a null-byte. This change makes us
ignore the zero length label instead.

Must be backported to 1.8.
This commit is contained in:
Lukas Tribus 2020-02-27 15:47:24 +01:00 committed by Willy Tarreau
parent 1ed3781e21
commit 81725b867c

View File

@ -1450,6 +1450,12 @@ int dns_str_to_dn_label(const char *str, int str_len, char *dn, int dn_len)
if (i == offset)
return -1;
/* ignore trailing dot */
if (i + 2 == str_len) {
i++;
break;
}
dn[offset] = (i - offset);
offset = i+1;
continue;