From 6052f28537ea56822d5f4c0f0101cb6471bbfbb9 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Wed, 24 Feb 2021 14:46:48 +0200 Subject: [PATCH] Use crypt_r in threaded code --- common/network/websocket.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/network/websocket.c b/common/network/websocket.c index 6585402..ccf492d 100644 --- a/common/network/websocket.c +++ b/common/network/websocket.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -929,7 +930,10 @@ ws_ctx_t *do_handshake(int sock) { snprintf(authbuf, 4096, "%s%s", settings.basicauth, pwbuf); authbuf[4095] = '\0'; - const char *encrypted = crypt(resppw, "$5$kasm$"); + struct crypt_data cdata; + cdata.initialized = 0; + + const char *encrypted = crypt_r(resppw, "$5$kasm$", &cdata); *resppw = '\0'; snprintf(pwbuf, 4096, "%s%s", response, encrypted);