From 69b78d94b188697906809547d00e185d9c7ec653 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Windows 11)" <rob@synchro.net> Date: Wed, 22 Nov 2023 14:57:15 -0800 Subject: [PATCH] Fix CID 469129 and 469141 using std::atomic<> Unlikely, but valid thread-safety concerns by Coverity --- src/sbbs3/sbbs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index 9ca0dd785f..dfd83e1e17 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -377,6 +377,7 @@ typedef struct js_callback { /* Synchronet Node Instance class definition */ #if defined(__cplusplus) && defined(JAVASCRIPT) +#include <atomic> #include <string> #include <unordered_map> @@ -414,7 +415,7 @@ public: CRYPT_SESSION ssh_session=-1; #endif int session_channel=-1; - bool ssh_mode = false; + std::atomic<bool> ssh_mode = false; SOCKET passthru_socket=INVALID_SOCKET; bool passthru_socket_active = false; void passthru_socket_activate(bool); @@ -467,7 +468,7 @@ public: uchar telnet_cmd[64]{}; uint telnet_cmdlen = 0; uint telnet_cmds_received = 0; - uint telnet_mode = 0; + std::atomic<uint> telnet_mode = 0; /* input_thread() writes to these variables: */ uchar telnet_last_rxch = 0; char telnet_location[128]{}; -- GitLab