Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for Miranda IM

Nov 26th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. typedef struct _textrangew
  2. {
  3.   CHARRANGE chrg;
  4.   LPWSTR lpstrText;
  5. } TEXTRANGEW;
  6.  
  7. const wchar_t* Utils::extractURLFromRichEdit(....)
  8. {
  9.   ...
  10.   ::CopyMemory(tr.lpstrText, L"mailto:", 7);
  11.   ...
  12. }
  13.  
  14. This is what should have been written here: sizeof(wchar_t) * 7
  15.  
  16. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V512 A call of the 'memcpy' function will lead to a buffer overflow or underflow. tabsrmm utils.cpp 1080
  19.  
  20. 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