Watt-32 tcp/ip  2.2 dev-rel.10
Data Structures | Functions | Variables
fortify.c File Reference

Go to the source code of this file.

Data Structures

struct  Header
 
class  Fortify_AutoLogFile
 

Functions

static int st_CheckBlock (struct Header *h, const char *file, DWORD line)
 
static int st_CheckFortification (BYTE *ptr, BYTE value, size_t size)
 
static void st_SetFortification (BYTE *ptr, BYTE value, size_t size)
 
static void st_OutputFortification (BYTE *ptr, BYTE value, size_t size)
 
static void st_HexDump (BYTE *ptr, size_t offset, size_t size, int title)
 
static void st_MakeHeaderValid (struct Header *h)
 
static int st_IsHeaderValid (const struct Header *h)
 
static WORD st_ChecksumHeader (const struct Header *h)
 
static int st_IsOnAllocatedList (const struct Header *h)
 
static int st_OutputHeader (struct Header *h)
 
static void st_OutputMemory (struct Header *h)
 
static void st_OutputLastVerifiedPoint (void)
 
static void st_DefaultOutput (const char *String)
 
static const char * st_MemoryBlockString (struct Header *h)
 
static void st_OutputDeleteTrace (void)
 
static const char * st_DeallocatedMemoryBlockString (struct Header *h)
 
static int st_IsOnDeallocatedList (const struct Header *h)
 
static int st_PurgeDeallocatedBlocks (DWORD Bytes, const char *file, DWORD line)
 
static int st_PurgeDeallocatedScope (BYTE Scope, const char *file, DWORD line)
 
static int st_CheckDeallocatedBlock (struct Header *h, const char *file, DWORD line)
 
static void st_FreeDeallocatedBlock (struct Header *h, const char *file, DWORD line)
 
static void message (BOOL warn, const char *fmt,...)
 
static Fortify_LockLocalData (int lock)
 
static void heap_integrity_check (BOOL on)
 
void *FORTIFY_STORAGE Fortify_Allocate (size_t size, unsigned char allocator, unsigned long flags, const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_Deallocate (void *uptr, BYTE deallocator, const char *file, DWORD line)
 
void Fortify_LabelPointer (void *uptr, const char *label, const char *file, DWORD line)
 
int FORTIFY_STORAGE Fortify_CheckPointer (void *uptr, const char *file, DWORD line)
 
Fortify_OutputFuncPtr
FORTIFY_STORAGE 
Fortify_SetOutputFunc (Fortify_OutputFuncPtr Output)
 
int FORTIFY_STORAGE Fortify_SetAllocateFailRate (int Percent)
 
DWORD FORTIFY_STORAGE Fortify_CheckAllMemory (const char *file, DWORD line)
 
BYTE FORTIFY_STORAGE Fortify_EnterScope (const char *file, DWORD line)
 
BYTE FORTIFY_STORAGE Fortify_LeaveScope (const char *file, DWORD line)
 
DWORD FORTIFY_STORAGE Fortify_ListAllMemory (const char *file, DWORD line)
 
DWORD FORTIFY_STORAGE Fortify_DumpAllMemory (const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_OutputStatistics (const char *file, DWORD line)
 
DWORD FORTIFY_STORAGE Fortify_GetCurrentAllocation (const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_SetAllocationLimit (DWORD NewLimit, const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_Disable (const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_Enable (const char *file, DWORD line)
 
void *FORTIFY_STORAGE Fortify_malloc (size_t size, const char *file, DWORD line)
 
voidFortify_realloc (void *uptr, size_t new_size, const char *file, DWORD line)
 
voidFortify_calloc (size_t num, size_t size, const char *file, DWORD line)
 
void Fortify_free (void *uptr, const char *file, DWORD line)
 
HGLOBAL Fortify_GlobalAlloc (UINT flags, DWORD size, const char *file, DWORD line)
 
BOOL Fortify_GlobalFree (void *ptr, const char *file, DWORD line)
 
char *FORTIFY_STORAGE Fortify_strdup (const char *oldStr, const char *file, DWORD line)
 
Fortify_NewHandlerFunc st_NewHandler (void)
 
void *FORTIFY_STORAGE operator new (size_t size)
 
void *FORTIFY_STORAGE operator new (size_t size, const char *file, DWORD line)
 
void *FORTIFY_STORAGE operator new[] (size_t size)
 
void *FORTIFY_STORAGE operator new[] (size_t size, const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_PreDelete (const char *file, DWORD line)
 
void FORTIFY_STORAGE Fortify_PostDelete (void)
 
void FORTIFY_STORAGE operator delete (void *uptr)
 
void FORTIFY_STORAGE operator delete[] (void *uptr)
 

Variables

static char st_Buffer [4096] = { 0 }
 
static struct Headerst_AllocatedHead = 0
 
static int st_AllocateFailRate = 0
 
static Fortify_OutputFuncPtr st_Output = st_DefaultOutput
 
static const char * st_LastVerifiedFile = "unknown"
 
static DWORD st_LastVerifiedLine = 0
 
static BYTE st_Scope = 0
 
static BYTE st_Disabled = 0
 
static char st_LockDataStart = 0
 
int gbl_FortifyMagic = 0
 
static const char * st_DeleteFile [FORTIFY_DELETE_STACK_SIZE]
 
static DWORD st_DeleteLine [FORTIFY_DELETE_STACK_SIZE]
 
static DWORD st_DeleteStackTop
 
static DWORD st_MaxBlocks = 0
 
static DWORD st_MaxAllocation = 0
 
static DWORD st_CurBlocks = 0
 
static DWORD st_CurAllocation = 0
 
static DWORD st_Allocations = 0
 
static DWORD st_Frees = 0
 
static DWORD st_TotalAllocation = 0
 
static DWORD st_AllocationLimit = 0xffffffff
 
static struct Headerst_DeallocatedHead = 0
 
static struct Headerst_DeallocatedTail = 0
 
static DWORD st_TotalDeallocated = 0
 
static const char * st_AllocatorName []
 
static const char * st_DeallocatorName []
 
static const BYTE st_ValidDeallocator []
 
static char st_LockDataEnd = 0
 
BYTE Check_heap_integrity_flag
 
BYTE Heap_init_byte
 
BYTE Init_allocated_storage
 
static Fortify_AutoLogFile Abracadabra
 

Detailed Description

A fortified memory allocation shell - V2.2.

Definition in file fortify.c.

Variable Documentation

const char* st_AllocatorName[]
static
Initial value:
= {
"malloc()",
"calloc()",
"realloc()",
"strdup()",
"new",
"new[]",
"GlobalAllocPtr()"
}

Definition at line 241 of file fortify.c.

const char* st_DeallocatorName[]
static
Initial value:
= {
"nobody",
"free()",
"realloc()",
"delete",
"delete[]",
"GlobalFreePtr()"
}

Definition at line 252 of file fortify.c.

const BYTE st_ValidDeallocator[]
static
Initial value:
= {
(1 << Fortify_Deallocator_free) | (1 << Fortify_Deallocator_realloc),
(1 << Fortify_Deallocator_free) | (1 << Fortify_Deallocator_realloc),
(1 << Fortify_Deallocator_free) | (1 << Fortify_Deallocator_realloc),
(1 << Fortify_Deallocator_free) | (1 << Fortify_Deallocator_realloc),
#if defined(FORTIFY_PROVIDE_ARRAY_NEW) && defined(FORTIFY_PROVIDE_ARRAY_DELETE)
(1 << Fortify_Deallocator_delete),
(1 << Fortify_Deallocator_array_delete)
#else
(1 << Fortify_Deallocator_delete) | (1 << Fortify_Deallocator_array_delete),
(1 << Fortify_Deallocator_delete) | (1 << Fortify_Deallocator_array_delete)
#endif
}

Definition at line 261 of file fortify.c.