Re: [PATCH] BUG/MINOR: dns: allow 63 char in hostname

2020-01-26 Thread William Dauchy
Hello Miroslav,

On Sun, Jan 26, 2020 at 2:57 AM Miroslav Zagorac  wrote:
> 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].

that is very true, d[i] does not make sense at this point. I will send v2.

Thanks,
-- 
William


Re: [PATCH] BUG/MINOR: dns: allow 63 char in hostname

2020-01-25 Thread Miroslav Zagorac

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

What can change the nature of a man?



[PATCH] BUG/MINOR: dns: allow 63 char in hostname

2020-01-25 Thread William Dauchy
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 
---
 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;
-- 
2.24.1