PVS-StudioWarnings

PVS-Studio warning V527 for ReactOS

Nov 13th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. static VOID
  2. AddScreenSavers(HWND hwndDlg, PDATA pData)
  3. {
  4.   ...
  5.   LPTSTR lpBackSlash;
  6.   lpBackSlash = _tcsrchr(szSearchPath, _T('\\'));
  7.   if (lpBackSlash != NULL)
  8.   {
  9.     lpBackSlash = '\0';
  10.     SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
  11.   }
  12. }
  13.  
  14. The programmer simply zeroed the IpBackSlash pointer instead of throwing off everything after the last \ character.
  15. This is what should have been written here: *lpBackSlash = '\0';
  16.  
  17. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V527 It is odd that the L'\0' value is assigned to 'wchar_t' type pointer. Probably meant: *lpBackSlash = L'\0'. desk screensaver.c 453
  20.  
  21. 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