From dea0a10b13931b8f536f640dc789a3e8812a8c05 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Thu, 13 Jun 2024 18:07:42 +0000 Subject: [PATCH] lock mutex of the receiver, not always the global var --- crypto/rand/default.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/rand/default.go b/crypto/rand/default.go index 87aab7d4c..432be66b1 100644 --- a/crypto/rand/default.go +++ b/crypto/rand/default.go @@ -33,8 +33,8 @@ func init() { } func (p *lockingPRNG) Read(s []byte) (n int, err error) { - globalRand.mu.Lock() - defer globalRand.mu.Unlock() + p.mu.Lock() + defer p.mu.Unlock() return p.PRNG.Read(s) }