From 243ddf5304b1c9e2c18896ea74870ae535b7875d Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 18 May 2017 17:27:14 +0300 Subject: [PATCH] Ensure no overrun before copying --- tinyxml2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tinyxml2.h b/tinyxml2.h index 17e576a..37871c5 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -284,6 +284,7 @@ private: TIXMLASSERT( cap <= INT_MAX / 2 ); int newAllocated = cap * 2; T* newMem = new T[newAllocated]; + TIXMLASSERT( newAllocated >= _size ); memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs if ( _mem != _pool ) { delete [] _mem;