PVS-StudioWarnings

PVS-Studio warning V512 for DDKSamples

Nov 17th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. typedef struct _DEVICE_INFO
  2. {
  3.   ....
  4.   WCHAR UnicodeSourceIp[MAX_LEN];
  5.   WCHAR UnicodeDestIp[MAX_LEN];
  6.   ....
  7. } DEVICE_INFO, *PDEVICE_INFO;
  8.  
  9. PDEVICE_INFO FindDeviceInfo(....)
  10. {
  11.   ....
  12.   PDEVICE_INFO    deviceInfo = NULL;
  13.   ....
  14.   memcpy(deviceInfo->UnicodeSourceIp,
  15.          InputInfo->SourceIp, MAX_LEN);
  16.   memcpy(deviceInfo->UnicodeDestIp,
  17.          InputInfo->DestIp, MAX_LEN);
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in DDKSamples project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V512 A call of the 'memcpy' function will lead to underflow of the buffer 'deviceInfo->UnicodeSourceIp'. testapp.c 729
  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