Core/Shared: Add thread-safe access to BigNumber::AsByteArray()

fixes #5469
This commit is contained in:
leak
2012-03-06 17:22:58 +01:00
parent 21086b0e0d
commit 700203ad1e
2 changed files with 7 additions and 0 deletions
@@ -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;
@@ -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