aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorleak <leak@bitmx.net>2012-03-06 17:21:52 +0100
committerleak <leak@bitmx.net>2012-03-06 17:22:58 +0100
commit700203ad1efa6e988472188121744453af5c6279 (patch)
treebfa7f4112acddcbdc44043e9c05030f45d937b03 /src
parent21086b0e0d78d7c0190b06ecafa5cd1e6b15e3c8 (diff)
Core/Shared: Add thread-safe access to BigNumber::AsByteArray()
fixes #5469
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/shared/Cryptography/BigNumber.cpp2
-rwxr-xr-xsrc/server/shared/Cryptography/BigNumber.h5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp
index f55e87c99fc..146ea778f48 100755
--- a/src/server/shared/Cryptography/BigNumber.cpp
+++ b/src/server/shared/Cryptography/BigNumber.cpp
@@ -169,6 +169,8 @@ uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
{
int length = (minSize >= GetNumBytes()) ? minSize : GetNumBytes();
+ ACE_GUARD_RETURN(ACE_Mutex, g, _lock, 0);
+
if (_array)
{
delete[] _array;
diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h
index 7196aae6579..6646245a6a0 100755
--- a/src/server/shared/Cryptography/BigNumber.h
+++ b/src/server/shared/Cryptography/BigNumber.h
@@ -20,6 +20,7 @@
#define _AUTH_BIGNUMBER_H
#include "Define.h"
+#include <ace/Mutex.h>
struct bignum_st;
@@ -89,6 +90,10 @@ class BigNumber
private:
struct bignum_st *_bn;
uint8 *_array;
+
+ // This mutex only controls thread-safe access to AsByteArray() and should be replaced with a thread-safe implementation of BigNumber
+ ACE_Mutex _lock;
+
};
#endif