PVS-StudioWarnings

PVS-Studio warning V514 for Miranda IM

Nov 13th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
  2.  
  3. int Cache_GetLineText(..., LPTSTR text, int text_size, ...)
  4. {
  5.   ...
  6.   tmi.printDateTime(pdnce->hTimeZone, _T("t"), text,
  7.                     SIZEOF(text), 0);
  8.   ...
  9. }
  10.  
  11. Most likely this is what should be written here: tmi.printDateTime(pdnce->hTimeZone, _T("t"), text, text_size, 0);
  12.  
  13. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V514 Dividing sizeof a pointer 'sizeof (text)' by another value. There is a probability of logical error presence.  clist_modern  modern_cachefuncs.cpp  567
  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