On 01/26/2020 12:39 AM, William Dauchy wrote:
hostname were limited to 62 char, which is not RFC1035 compliant;
simply remove equality in condition as counter is initialised at zero.
(also simplify brackets for readability)

this should github issue #387

Signed-off-by: William Dauchy<w.dau...@criteo.com>
---
  src/dns.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dns.c b/src/dns.c
index eefd8d0dc..8b3a0927e 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -1497,7 +1497,7 @@ int dns_hostname_validation(const char *string, char 
**err)
                        d++;
                }

-               if ((i>= DNS_MAX_LABEL_SIZE)&&  (d[i] != '.')) {
+               if (i>  DNS_MAX_LABEL_SIZE&&  d[i] != '.') {
                        if (err)
                                *err = DNS_LABEL_TOO_LONG;
                        return 0;

Hello William,

i think that patch does not correct the bug in that function because in the loop above the variable i and pointer d increase at the same time.

This means that *d should be written instead of d[i].

--
Zaga    <miros...@zagorac.name>

What can change the nature of a man?

Reply via email to