Advertisement
PVS-StudioWarnings

PVS-Studio warning V527 for PNG library

Nov 27th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. png_size_t /* PRIVATE */
  2. png_check_keyword(png_structp png_ptr, png_charp key,
  3.                   png_charpp new_key)
  4. {
  5.   ...
  6.   if (key_len > 79)
  7.   {
  8.     png_warning(png_ptr,
  9.                 "keyword length must be 1 - 79 characters");
  10.     new_key[79] = '\0';
  11.     key_len = 79;
  12.   }
  13.   ...
  14. }
  15.  
  16. This is what should have been written here: (*new_key)[79] = '\0';
  17.  
  18. This suspicious code was found in PNG library project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *new_key [79] = '\0'. graphics3D pngwutil.c 1283
  21.  
  22. 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