From 7cee95c3d95d6522229fa7aafded5c6a1e4812a5 Mon Sep 17 00:00:00 2001 From: Roman Janota Date: Wed, 23 Sep 2026 11:43:49 +0200 Subject: [PATCH] session server BUGFIX reserve binds by total count LYA_PREALLOC() takes the new count of the array, not the number of added items. Reserving only the new binds relied on libyang over-allocating and overflows the non-empty registry once libyang allocates exactly the requested count. --- src/session_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/session_server.c b/src/session_server.c index bfc5719a..15608196 100644 --- a/src/session_server.c +++ b/src/session_server.c @@ -3439,7 +3439,7 @@ nc_server_binds_reconcile(const struct nc_server_config *config) /* register the new sockets, reserve the space in advance */ if (new_count) { - LYA_PREALLOC(server_opts.binds, new_count, ERRMEM; rc = 1; goto cleanup); + LYA_PREALLOC(server_opts.binds, LYA_COUNT(server_opts.binds) + new_count, ERRMEM; rc = 1; goto cleanup); } LYA_FOR(descs, u) { if (descs[u].reused) {