William,

Am 26.01.20 um 11:07 schrieb William Dauchy:
> diff --git a/src/dns.c b/src/dns.c
> index eefd8d0dc..dccd0498c 100644
> --- a/src/dns.c
> +++ b/src/dns.c
> @@ -1484,7 +1484,7 @@ int dns_hostname_validation(const char *string, char 
> **err)
>               d = c;
>  
>               i = 0;
> -             while (*d != '.' && *d && i <= DNS_MAX_LABEL_SIZE) {
> +             while (*d != '.' && *d && i < DNS_MAX_LABEL_SIZE) {
>                       i++;

I wonder if we should move the `i++` down to above the `d++`. `i` is not
being used in the loop body and the only way to exit the loop is the
`return`. Moving it down has the benefit that it's not as easy to miss
that both are incremented within the loop (like you did in your first
patch).

Or we could get rid of either `i` or `d` entirely and replace it by `(d
- c)` or `c[i]` respectively.

Best regards
Tim Düsterhus

Reply via email to