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.
---

As discussed in issue #435

---
 src/dns.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/dns.c b/src/dns.c
index c131f08..e2fa387 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -1208,6 +1208,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;
-- 
2.7.4


Reply via email to