PVS-StudioWarnings

PVS-Studio warning V507 for Source SDK

Nov 27th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. static Activity DetermineExpressionMoveActivity(
  2.   CChoreoEvent *event, CAI_BaseNPC *pNPC )
  3. {
  4.   ....
  5.   const char *pszAct = Q_strstr( sParam2, " " );
  6.   if ( pszAct )
  7.   {
  8.     char szActName[256];
  9.     Q_strncpy( szActName, sParam2, sizeof(szActName) );
  10.     szActName[ (pszAct-sParam2) ] = '\0';
  11.     pszAct = szActName;
  12.   }
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in Source SDK project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V507 Pointer to local array 'szActName' is stored outside the scope of this array. Such a pointer will become invalid. Server (HL2) baseflex.cpp 1326
  19.  
  20. 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