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.
| 78 | // for security reason, compiler optimizer can remove such call. |
| 79 | // So we use our own function for this purpose. |
| 80 | void 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 |
no outgoing calls
no test coverage detected