MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / cleandata

Function cleandata

Libraries/unrar/secpassword.cpp:80–93  ·  view source on GitHub ↗

When we call memset in end of function to clean local variables for security reason, compiler optimizer can remove such call. So we use our own function for this purpose.

Source from the content-addressed store, hash-verified

78// for security reason, compiler optimizer can remove such call.
79// So we use our own function for this purpose.
80void cleandata(void *data,size_t size)
81{
82 if (data==NULL || size==0)
83 return;
84#if defined(_WIN_ALL) && defined(_MSC_VER)
85 SecureZeroMemory(data,size);
86#else
87 // 'volatile' is required. Otherwise optimizers can remove this function
88 // if cleaning local variables, which are not used after that.
89 volatile byte *d = (volatile byte *)data;
90 for (size_t i=0;i<size;i++)
91 d[i]=0;
92#endif
93}
94
95
96// We got a complain from user that it is possible to create WinRAR dump

Callers 15

~ArrayMethod · 0.85
AddMethod · 0.85
ProcessSwitchMethod · 0.85
~DataHashMethod · 0.85
RARSetPasswordFunction · 0.85
GetPasswordTextFunction · 0.85
GetConsolePasswordFunction · 0.85
getwstrFunction · 0.85
CleanMethod · 0.85
LengthMethod · 0.85
operator ==Method · 0.85
pbkdf2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected