From 23474693673eaeede18e0487bb71be84cd8eb6d2 Mon Sep 17 00:00:00 2001 From: Badr Bacem KAABIA Date: Sat, 8 Nov 2025 23:12:14 +0100 Subject: [PATCH] wh_server: fix server comm not initialized from config wh_Server_Init never assigns server->comm from config->comm before calling wh_CommServer_Init(server->comm, ...). That passes an uninitialized (zeroed) pointer to wh_CommServer_Init and will likely crash or behave incorrectly. Suggested minimal fix Assign server->comm = config->comm (and validate config->comm != NULL) before calling wh_CommServer_Init. Signed-off-by: Badr Bacem KAABIA --- src/wh_server.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wh_server.c b/src/wh_server.c index 3ca4fa3e5..bc2dddde2 100644 --- a/src/wh_server.c +++ b/src/wh_server.c @@ -74,6 +74,11 @@ int wh_Server_Init(whServerContext* server, whServerConfig* config) } memset(server, 0, sizeof(*server)); + if (config->comm == NULL) { + return WH_ERROR_BADARGS; + } + server->comm = config->comm; + server->nvm = config->nvm; #ifndef WOLFHSM_CFG_NO_CRYPTO