PVS-StudioWarnings

PVS-Studio warning V557 for Wolf

Nov 10th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. typedef struct bot_state_s
  2. {
  3.   ...
  4.   char teamleader[32]; //netname of the team leader
  5.   ...
  6. }  bot_state_t;
  7.  
  8. void BotMatch_StartTeamLeaderShip(
  9.   bot_state_t *bs, bot_match_t *match)
  10. {
  11.   ...
  12.   bs->teamleader[sizeof( bs->teamleader )] = '\0';
  13.   ...
  14. }
  15.  
  16. -1 is missing. The same error can be found in Quake 3.
  17.  
  18.  
  19. This suspicious code was found in Wolf project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V557 Array overrun is possible. The 'sizeof (bs->teamleader)' index is pointing beyond array bound. game ai_cmd.c 1069
  22.  
  23. 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