From aec1a0940c8aded325dc8101669eae5257686ded Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 6 Feb 2025 11:59:44 -0400 Subject: [PATCH] MT#62053 add safeguard against broken port ranges Change-Id: I5e4fa46b5d75253129e887da8ddbba4fc60702f5 --- daemon/media_socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 75558134f..83cf763ae 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -820,6 +820,10 @@ static void __interface_append(struct intf_config *ifa, sockfamily_t *fam, bool spec = t_hash_table_lookup(__intf_spec_addr_type_hash, &ifa->local_address); if (!spec) { + if (ifa->port_min == 0 || ifa->port_max == 0 || ifa->port_min > 65535 + || ifa->port_max > 65535 || ifa->port_min > ifa->port_max) + die("Invalid RTP port range (%d > %d)", ifa->port_min, ifa->port_max); + spec = g_slice_alloc0(sizeof(*spec)); spec->local_address = ifa->local_address; spec->port_pool.free_ports = g_new0(ports_list *, ifa->port_max - ifa->port_min + 1);