mirror of https://github.com/FreeRDP/FreeRDP
libwinpr-crt: added SecureZeroMemory
This commit is contained in:
parent
76414588b1
commit
cc301348df
|
@ -30,9 +30,11 @@
|
|||
|
||||
#define CopyMemory(Destination, Source, Length) memcpy((Destination), (Source), (Length))
|
||||
#define MoveMemory(Destination, Source, Length) memmove((Destination), (Source), (Length))
|
||||
#define FillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
|
||||
#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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue