PVS-StudioWarnings

PVS-Studio warning V597 for PHP

Nov 20th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. /*
  2.  * MD5 password encryption.
  3.  */
  4. char* php_md5_crypt_r(const char *pw,const char *salt, char *out)
  5. {
  6.   static char passwd[MD5_HASH_MAX_LEN], *p;
  7.   unsigned char final[16];
  8.   ....
  9.   /* Don't leave anything around in vm they could use. */
  10.   memset(final, 0, sizeof(final));  //<==
  11.   return (passwd);
  12. }
  13.  
  14. This suspicious code was found in PHP project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V597 The compiler could delete the 'memset' function call, which is used to flush 'final' buffer. The RtlSecureZeroMemory() function should be used to erase the private data. php_crypt_r.c 421
  17.  
  18. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment