Advertisement
PVS-StudioWarnings

PVS-Studio warning V575 for Miranda IM

Nov 21st, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size)
  2. {
  3.   ...
  4.   memset(&iad->nodes[iad->nodes_allocated_size],
  5.     (size_grow - iad->nodes_allocated_size) *
  6.        sizeof(IMAGE_ARRAY_DATA_NODE),
  7.     0);
  8.   ...
  9. }
  10.  
  11. Arguments are mixed up. This is what should have been written here: memset(&iad->nodes[iad->nodes_allocated_size], 0, (size_grow - iad->nodes_allocated_size) * sizeof(IMAGE_ARRAY_DATA_NODE));
  12.  
  13. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V575 The 'memcmp' function processes '0' elements. Inspect the 'third' argument.  clist_modern  modern_image_array.cpp  59
  16.  
  17. 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