]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix port validation rejecting valid port 65535
authorOndřej Surý <ondrej@sury.org>
Wed, 11 Mar 2026 12:18:01 +0000 (13:18 +0100)
committerOndřej Surý <ondrej@sury.org>
Sat, 14 Mar 2026 09:11:55 +0000 (10:11 +0100)
A few port validation checks use >= UINT16_MAX instead of > UINT16_MAX,
incorrectly rejecting port 65535 as out of range.  Port 65535 is a valid
TCP/UDP port number.  Other port checks in the same file already use the
correct > comparison.

bin/named/config.c
bin/named/server.c
lib/isccfg/check.c

index 7c74b527393d508a8309fe0f9d60adf795f2a37f..a4753671091e4e067be1b71f5959d39bbc26921f 100644 (file)
@@ -654,7 +654,7 @@ named_config_getport(const cfg_obj_t *config, const char *type,
 
        result = named_config_get(maps, type, &portobj);
        INSIST(result == ISC_R_SUCCESS);
-       if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
+       if (cfg_obj_asuint32(portobj) > UINT16_MAX) {
                cfg_obj_log(portobj, ISC_LOG_ERROR, "port '%u' out of range",
                            cfg_obj_asuint32(portobj));
                return ISC_R_RANGE;
index 25eb888e7ad9b2cd8e41dd98782b97502a6348b3..fa51bd260f597d631dd3518ec1aa8bfc0fbbaa7d 100644 (file)
@@ -10556,7 +10556,7 @@ listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
                        }
                }
        } else {
-               if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
+               if (cfg_obj_asuint32(portobj) > UINT16_MAX) {
                        return ISC_R_RANGE;
                }
                port = (in_port_t)cfg_obj_asuint32(portobj);
index 87c9fa7547cc2b4da8eb0aa60fae728db941d43b..6596b50637142e5c48610b499e534553a0ee38bc 100644 (file)
@@ -487,7 +487,7 @@ checkacl(const char *aclname, cfg_aclconfctx_t *aclctx,
                        cfg_tuple_get(aclobj, "port-transport"), "transport");
 
                if (cfg_obj_isuint32(obj_port) &&
-                   cfg_obj_asuint32(obj_port) >= UINT16_MAX)
+                   cfg_obj_asuint32(obj_port) > UINT16_MAX)
                {
                        cfg_obj_log(obj_port, ISC_LOG_ERROR,
                                    "port value '%u' is out of range",
@@ -1067,8 +1067,7 @@ check_listener(const cfg_obj_t *listener, const cfg_obj_t *config,
        }
 
        portobj = cfg_tuple_get(ltup, "port");
-       if (cfg_obj_isuint32(portobj) &&
-           cfg_obj_asuint32(portobj) >= UINT16_MAX)
+       if (cfg_obj_isuint32(portobj) && cfg_obj_asuint32(portobj) > UINT16_MAX)
        {
                cfg_obj_log(portobj, ISC_LOG_ERROR,
                            "port value '%u' is out of range",
@@ -1166,7 +1165,7 @@ check_port(const cfg_obj_t *options, const char *type, in_port_t *portp) {
                return ISC_R_SUCCESS;
        }
 
-       if (cfg_obj_asuint32(portobj) >= UINT16_MAX) {
+       if (cfg_obj_asuint32(portobj) > UINT16_MAX) {
                cfg_obj_log(portobj, ISC_LOG_ERROR, "port '%u' out of range",
                            cfg_obj_asuint32(portobj));
                return ISC_R_RANGE;