PVS-StudioWarnings

PVS-Studio warning V597 for Asterisk

Nov 12th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. static int silence_generator_generate(....)
  2. {
  3.   short buf[samples];
  4.  
  5.   struct ast_frame frame = {
  6.     .frametype = AST_FRAME_VOICE,
  7.     .data.ptr = buf,
  8.     .samples = samples,
  9.     .datalen = sizeof(buf),
  10.   };
  11.   frame.subclass.format = ast_format_slin;
  12.  
  13.   memset(buf, 0, sizeof(buf));      //<==
  14.   ....
  15. }
  16.  
  17. This suspicious code was found in Asterisk project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V597 The compiler could delete the 'memset' function call, which is used to flush 'buf' buffer. The RtlSecureZeroMemory() function should be used to erase the private data. channel.c 7742
  20.  
  21. 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