commit 09c4a22975cf02c77c8326e5fdf26a90fa61b5c7
parent 46c0d3f4704b138ca279881c8cb222feb77989c6
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Wed, 25 Aug 2021 20:50:07 +0300
websocket_threaded_example: fix static analyzer error
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c
@@ -495,7 +495,11 @@ ws_get_accept_value (const char *key, char **val)
strncpy (str + WS_KEY_LEN, WS_GUID, WS_GUID_LEN + 1);
SHA1Reset (&ctx);
SHA1Input (&ctx, (const unsigned char *) str, WS_KEY_GUID_LEN);
- SHA1Result (&ctx, hash);
+ if (SHA1_RESULT_SUCCESS != SHA1Result (&ctx, hash))
+ {
+ free (str);
+ return MHD_NO;
+ }
free (str);
len = BASE64Encode (hash, SHA1HashSize, val);
if (-1 == len)