libwinpr-crt: added SecureZeroMemory

This commit is contained in:
Marc-André Moreau 2013-11-01 18:32:36 -04:00
parent 76414588b1
commit cc301348df
2 changed files with 14 additions and 1 deletions

View File

@ -33,6 +33,8 @@
#define FillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
#define ZeroMemory(Destination, Length) memset((Destination), 0, (Length))
WINPR_API PVOID SecureZeroMemory(PVOID ptr, SIZE_T cnt);
#endif
#include <winpr/heap.h>

View File

@ -28,6 +28,17 @@
#ifndef _WIN32
PVOID SecureZeroMemory(PVOID ptr, SIZE_T cnt)
{
volatile BYTE* p = ptr;
while (cnt--)
{
*p = 0;
p++;
}
return ptr;
}
#endif