upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-09-02 06:51:07 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-09-02 06:51:07 +0000
commita44c9402c20493f0964a1296dd38d313216fbd4d (patch)
tree0337a9ba2b8dcf2f4004ac78d76e7c31ef84778a
parente4f898c4a6b9900553c64b9804889b5fdae3e55f (diff)
util: initialise CCriticalSection's diagnostic fields at construction
pszFile/nLine were first written by CRITICAL_BLOCK on entry, so an instance embedded in a dynamically allocated object (CNode::cs_vSend, cs_vRecv, cs_inventory) held indeterminate values until its first lock -- anything reading them for diagnostics dereferenced a wild pointer.
-rw-r--r--src/util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.h b/src/util.h
index d72518b..58d1638 100644
--- a/src/util.h
+++ b/src/util.h
@@ -199,7 +199,7 @@ protected:
199public: 199public:
200 char* pszFile; 200 char* pszFile;
201 int nLine; 201 int nLine;
202 explicit CCriticalSection() { InitializeCriticalSection(&cs); } 202 explicit CCriticalSection() : pszFile(NULL), nLine(0) { InitializeCriticalSection(&cs); }
203 ~CCriticalSection() { DeleteCriticalSection(&cs); } 203 ~CCriticalSection() { DeleteCriticalSection(&cs); }
204 void Enter() { EnterCriticalSection(&cs); } 204 void Enter() { EnterCriticalSection(&cs); }
205 void Leave() { LeaveCriticalSection(&cs); } 205 void Leave() { LeaveCriticalSection(&cs); }