diff options
author | jackpoz <giacomopoz@gmail.com> | 2013-08-24 17:49:14 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2013-08-24 17:49:14 +0200 |
commit | 21459739c63828ae7b5a74e87cbf44703d51ce8d (patch) | |
tree | be522bf13e54574138f76413fd4720031533eea9 | |
parent | 58e6503eef9245c937004a362ab767444e9f046d (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.h | 2 |
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); |