Advertisement
PVS-StudioWarnings

PVS-Studio warning V579 for ReactOS

Nov 25th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. static const PCHAR Nv11Board = "NV11 (GeForce2) Board";
  2. static const PCHAR Nv11Chip = "Chip Rev B2";
  3. static const PCHAR Nv11Vendor = "NVidia Corporation";
  4.  
  5. BOOLEAN
  6. IsVesaBiosOk(....)
  7. {
  8.   ...
  9.   if (!(strncmp(Vendor, Nv11Vendor, sizeof(Nv11Vendor))) &&
  10.       !(strncmp(Product, Nv11Board, sizeof(Nv11Board))) &&
  11.       !(strncmp(Revision, Nv11Chip, sizeof(Nv11Chip))) &&
  12.       (OemRevision == 0x311))
  13.   ...
  14. }
  15.  
  16. The error is this: sizeof() returns the pointer size, not string length.
  17.  
  18.  
  19. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V579 The strncmp function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. vga vbe.c 57
  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
Advertisement