Explorar o código

Ensure no overrun before copying

Dmitry-Me %!s(int64=8) %!d(string=hai) anos
pai
achega
243ddf5304
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      tinyxml2.h

+ 1 - 0
tinyxml2.h

@@ -284,6 +284,7 @@ private:
             TIXMLASSERT( cap <= INT_MAX / 2 );
             TIXMLASSERT( cap <= INT_MAX / 2 );
             int newAllocated = cap * 2;
             int newAllocated = cap * 2;
             T* newMem = new T[newAllocated];
             T* newMem = new T[newAllocated];
+            TIXMLASSERT( newAllocated >= _size );
             memcpy( newMem, _mem, sizeof(T)*_size );	// warning: not using constructors, only works for PODs
             memcpy( newMem, _mem, sizeof(T)*_size );	// warning: not using constructors, only works for PODs
             if ( _mem != _pool ) {
             if ( _mem != _pool ) {
                 delete [] _mem;
                 delete [] _mem;