![]() |
Memory bug in XTPMarkupStatic |
Post Reply
|
| Author | |
DavidH
Groupie
Joined: 24 March 2007 Status: Offline Points: 62 |
Post Options
Thanks(0)
Quote Reply
Topic: Memory bug in XTPMarkupStaticPosted: 1 hour 56 minutes ago at 4:08pm |
|
In Source/Controls/Static/XTPMarkupStatic.cpp, a growing buffer is not reallocated correctly. template<class T> AFX_INLINE BOOL XTPStrPushChr(T*& pStr, T ch, SIZE_T& nPos, SIZE_T& nSize) { if (NULL == pStr) { nSize = 0x100; pStr = (T*)malloc(nSize * sizeof(T)); if (NULL == pStr) return FALSE; *pStr = T('\0'); nPos = 0; } pStr[nPos] = ch; if (++nPos == nSize) { nSize *= 2; // --->>>> pStr = (T*)realloc(pStr, nSize); // Should be: pStr = (T*)realloc(pStr, nSize * sizeof(T));
if (NULL == pStr) return FALSE; pStr[nPos] = T('\0'); } return TRUE; } |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |