PVS-StudioWarnings

PVS-Studio warning V579 for MAME

Nov 19th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. static const char *apr_magic =
  2.   "ACT Apricot disk image\x1a\x04";
  3.  
  4. FLOPPY_IDENTIFY( apridisk_identify )
  5. {
  6.   UINT8 header[APR_HEADER_SIZE];
  7.  
  8.   /* get header */
  9.   floppy_image_read(floppy, &header, 0, sizeof(header));
  10.  
  11.   /* look for the magic string */
  12.   if (memcmp(header, apr_magic, sizeof(apr_magic)) == 0)
  13.   ...
  14. }
  15.  
  16. This suspicious code was found in MAME project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V579 The memcmp function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument.  apridisk.c 128
  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