Advertisement
PVS-StudioWarnings

PVS-Studio warning V514 for ReactOS

Nov 26th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. VOID
  2. GetDriveNameWithLetter(LPWSTR szText, UINT Length, WCHAR Drive)
  3. {
  4.   ...
  5.   TempLength = LoadStringW(shell32_hInstance,
  6.     IDS_DRIVE_FIXED, &szText[Length+1],
  7.     (sizeof(szText)/sizeof(WCHAR))- Length - 2);
  8.   ...
  9. }
  10.  
  11. "sizeof(szText)/sizeof(WCHAR)" - the pointer size is divided by the WCHAR size. The programmer seems to have intended to do some different thing.
  12.  
  13. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V514 Dividing sizeof a pointer 'sizeof (szText)' by another value. There is a probability of logical error presence. shell32 drive.c 126
  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