Skip to content

Commit 2347469

Browse files
committed
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 <[email protected]>
1 parent 04b199f commit 2347469

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/wh_server.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ int wh_Server_Init(whServerContext* server, whServerConfig* config)
7474
}
7575

7676
memset(server, 0, sizeof(*server));
77+
if (config->comm == NULL) {
78+
return WH_ERROR_BADARGS;
79+
}
80+
server->comm = config->comm;
81+
7782
server->nvm = config->nvm;
7883

7984
#ifndef WOLFHSM_CFG_NO_CRYPTO

0 commit comments

Comments
 (0)