PVS-StudioWarnings

PVS-Studio warning V557 for dumb

Nov 12th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. struct IT_SAMPLE
  2. {
  3.   ...
  4.   unsigned char filename[14];
  5.   ...
  6. };
  7.  
  8. static int it_riff_dsmf_process_sample(
  9.   IT_SAMPLE * sample, const unsigned char * data, int len)
  10. {
  11.   int flags;
  12.   memcpy( sample->filename, data, 13 );
  13.   sample->filename[ 14 ] = 0;
  14.   ...
  15. }
  16.  
  17. This is what should have been written here: sample->filename[ 13 ] = 0;
  18.  
  19. This suspicious code was found in dumb project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V557 Array overrun is possible. The '14' index is pointing beyond array bound. dumb_static readdsmf.c 34
  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