aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2013-08-24 17:49:14 +0200
committerjackpoz <giacomopoz@gmail.com>2013-08-24 17:49:14 +0200
commit21459739c63828ae7b5a74e87cbf44703d51ce8d (patch)
treebe522bf13e54574138f76413fd4720031533eea9
parent58e6503eef9245c937004a362ab767444e9f046d (diff)
Fix uninitialized UpdateMask field
Initialized UpdateMask::_bits to NULL in all constructors. UpdateMask(UpdateMask const& right) constructor sets the field count with SetCount() method before any field initialization. This means that SetCount() will call delete[] on the uninitialized _bits pointer field, leading to undefined behavior.
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateMask.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h
index 8be8dfecdaf..72c9e9945d0 100644
--- a/src/server/game/Entities/Object/Updates/UpdateMask.h
+++ b/src/server/game/Entities/Object/Updates/UpdateMask.h
@@ -36,7 +36,7 @@ class UpdateMask
UpdateMask() : _fieldCount(0), _blockCount(0), _bits(NULL) { }
- UpdateMask(UpdateMask const& right)
+ UpdateMask(UpdateMask const& right) : _bits(NULL)
{
SetCount(right.GetCount());
memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32);