Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for Wolf

Nov 27th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. typedef struct
  2. {
  3.   short int bodyPart[2];
  4.   short int animIndex[2];
  5.   short int animDuration[2];
  6.   short int soundIndex;
  7.   short int accShowBits;
  8.   short int accHideBits;
  9. } animScriptCommand_t;
  10.  
  11. void BG_ParseCommands(....) {
  12.   ...
  13.   animScriptCommand_t *command = NULL;
  14.   ...
  15.   memset( command, 0, sizeof( command ) );
  16.   ...
  17. }
  18.  
  19. This is what should have been written here: sizeof(*command)
  20.  
  21. This suspicious code was found in Wolf project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V512 A call of the 'memset' function will lead to a buffer overflow or underflow. cgame bg_animation.c 999
  24.  
  25. 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
Advertisement