fix: dev: Fix port validation rejecting valid port 65535

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

Merge branch 'ondrej/fix-port-validation-rejecting-valid-port-65535' into 'main'

See merge request isc-projects/bind9!11665
This commit is contained in:
Ondřej Surý 2026-03-14 11:02:10 +01:00
commit 38d0bbd0b8
3 changed files with 5 additions and 6 deletions

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

View 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);

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