Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for iecsdk

Nov 27th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. void plt_tools_get_pl_config_full_file_name(char *buffer) {
  2.   ...
  3.   char temp[PL_MAX_PATH] = { '\0' };
  4.   ...
  5.   memset(
  6.     temp,
  7.     0,
  8.     sizeof(buffer)
  9.   );
  10.   ...
  11. }
  12.  
  13. This is what should have been written here: sizeof(temp)
  14.  
  15. This suspicious code was found in iecsdk project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V512 A call of the 'memset' function will lead to underflow of the buffer 'temp'. core_api_unit_tests unit_tests_tools.c 379
  18.  
  19. 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