[Box Backup-dev] COMMIT r236 - box/chris/boxi/lib/common
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Thu, 15 Dec 2005 00:41:20 +0000 (GMT)
Author: chris
Date: 2005-12-15 00:41:19 +0000 (Thu, 15 Dec 2005)
New Revision: 236
Modified:
box/chris/boxi/lib/common/DebugMemLeakFinder.cpp
Log:
* DebugMemLeakFinder.cpp
- Avoid buffer overflow on memory leaks when code compiled in debug mode
Modified: box/chris/boxi/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/chris/boxi/lib/common/DebugMemLeakFinder.cpp 2005-12-15 00:40:32 UTC (rev 235)
+++ box/chris/boxi/lib/common/DebugMemLeakFinder.cpp 2005-12-15 00:41:19 UTC (rev 236)
@@ -180,7 +180,9 @@
}
else
{
- sNotLeaksPre[sNotLeaksPreNum++] = ptr;
+ if ( sNotLeaksPreNum <
+ (unsigned)( sizeof(sNotLeaksPre)/sizeof(*sNotLeaksPre) ) )
+ sNotLeaksPre[sNotLeaksPreNum++] = ptr;
}
/* {
std::map<void *, MallocBlockInfo>::iterator i(sMallocBlocks.find(ptr));