PVS-StudioWarnings

PVS-Studio warning V514 for ReactOS

Nov 20th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. typedef struct _UNICODE_STRING {
  2.   USHORT Length;
  3.   USHORT MaximumLength;
  4.   PWSTR  Buffer;
  5. } UNICODE_STRING, *PUNICODE_STRING;
  6.  
  7. UNICODE_STRING DosDevices =
  8.   RTL_CONSTANT_STRING(L"\\DosDevices\\");
  9.  
  10. NTSTATUS CreateNewDriveLetterName(....)
  11. {
  12.   ....
  13.   DriveLetter->Buffer[
  14.     sizeof(DosDevices.Buffer) / sizeof(WCHAR)] =
  15.       (WCHAR)Letter;
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V514 Dividing sizeof a pointer 'sizeof (DosDevices.Buffer)' by another value. There is a probability of logical error presence. mountmgr.c 164
  22.  
  23. 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