[PATCH 1/7] RADIUS DAS: Initialize socket to -1 before bind

Seb Adamski seb at bionic.network
Sun Oct 18 23:38:08 PDT 2026


radius_das_init() allocates the context with os_zalloc(), so das->sock
is 0 until radius_das_open_socket() returns. If os_memdup() of the
shared secret fails before that, radius_das_deinit() sees sock >= 0 and
closes file descriptor 0, which belongs to someone else.

Mark the socket as not open right after the allocation.

Signed-off-by: Seb Adamski <seb at bionic.network>
---
 src/radius/radius_das.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/radius/radius_das.c b/src/radius/radius_das.c
index 8d7c9b4c4..d3d9f75ec 100644
--- a/src/radius/radius_das.c
+++ b/src/radius/radius_das.c
@@ -556,6 +556,7 @@ radius_das_init(struct radius_das_conf *conf)
 	if (das == NULL)
 		return NULL;
 
+	das->sock = -1;
 	das->time_window = conf->time_window;
 	das->require_event_timestamp = conf->require_event_timestamp;
 	das->require_message_authenticator =
-- 
2.54.0 (Apple Git-157)





More information about the Hostap mailing list