PVS-StudioWarnings

PVS-Studio warning V627 for samba

Nov 13th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #define HBIN_HDR_SIZE    4
  2.  
  3. char header[HBIN_HDR_SIZE];
  4.  
  5. static REGF_HBIN* regf_hbin_allocate(REGF_FILE *file,
  6.                                      uint32 block_size)
  7. {
  8.   REGF_HBIN *hbin;
  9.   ....
  10.   memcpy( hbin->header, "hbin", sizeof(HBIN_HDR_SIZE) );
  11.   ....
  12. }
  13.  
  14. It works. Good luck: sizeof(4) == 4.
  15.  
  16. This suspicious code was found in samba project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V627 Consider inspecting the expression. The argument of sizeof() is the macro which expands to a number. regfio.c 1470
  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