]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: resolvers: do not reject host names of length 255 in SRV records
authorWilly Tarreau <w@1wt.eu>
Thu, 14 Oct 2021 06:00:38 +0000 (08:00 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 14 Oct 2021 19:24:18 +0000 (21:24 +0200)
An off-by-one issue in buffer size calculation used to limit the output
of resolv_dn_label_to_str() to 254 instead of 255.

This must be backported to 2.0.

src/resolvers.c

index aec66be2423c6a100bc14f6b5e43b6c911c12106..66f032913d112290bcd7d65b5a66d608d728db3c 100644 (file)
@@ -778,10 +778,10 @@ srv_found:
 
                                if (!srv->hostname_dn) {
                                        const char *msg = NULL;
-                                       char hostname[DNS_MAX_NAME_SIZE];
+                                       char hostname[DNS_MAX_NAME_SIZE+1];
 
                                        if (resolv_dn_label_to_str(item->target, item->data_len+1,
-                                                               hostname, DNS_MAX_NAME_SIZE) == -1) {
+                                                                  hostname, sizeof(hostname)) == -1) {
                                                HA_SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
                                                continue;
                                        }