PVS-StudioWarnings

PVS-Studio warning V547 for NetXMS

Nov 20th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. typedef UINT_PTR SOCKET;
  2.  
  3. static int DoRadiusAuth(....)
  4. {
  5.   SOCKET sockfd;
  6.   ....
  7.   // Open a socket.
  8.   sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  9.   if (sockfd < 0)
  10.   {
  11.     DbgPrintf(3, _T("RADIUS: Cannot create socket"));
  12.     pairfree(req);
  13.     return 5;
  14.   }
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in NetXMS project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression 'sockfd < 0' is always false. Unsigned type value is never < 0. radius.cpp 682
  21.  
  22. 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