Advertisement
PVS-StudioWarnings

PVS-Studio warning V595 for NetXMS

Nov 10th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. DWORD SNMP_PDU::encodeV3SecurityParameters(
  2.   BYTE *buffer, DWORD bufferSize,
  3.   SNMP_SecurityContext *securityContext)
  4. {
  5.   BYTE securityParameters[1024], sequence[1040];
  6.   DWORD bytes;
  7.   DWORD engineBoots =
  8.     securityContext->getAuthoritativeEngine().getBoots();
  9.   DWORD engineTime =
  10.     securityContext->getAuthoritativeEngine().getTime();
  11.  
  12.   if ((securityContext != NULL) &&
  13.       (securityContext->getSecurityModel() ==
  14.        SNMP_SECURITY_MODEL_USM))
  15.   {
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in NetXMS project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V595 The 'securityContext' pointer was utilized before it was verified against nullptr. Check lines: 1159, 1162. pdu.cpp 1159
  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
Advertisement