PVS-StudioWarnings

PVS-Studio warning V645 for icu

Nov 10th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #define uprv_strncat(dst, src, n) \
  2.   U_STANDARD_CPP_NAMESPACE strncat(dst, src, n)
  3.  
  4. static char plugin_file[2048] = "";
  5.  
  6. U_CAPI void U_EXPORT2
  7. uplug_init(UErrorCode *status)
  8. {
  9.   ....
  10.   uprv_strncpy(plugin_file, plugin_dir, 2047);
  11.   uprv_strncat(plugin_file, U_FILE_SEP_STRING,2047);
  12.   uprv_strncat(plugin_file, "icuplugins",2047);
  13.   uprv_strncat(plugin_file, U_ICU_VERSION_SHORT ,2047);
  14.   uprv_strncat(plugin_file, ".txt" ,2047);
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in icu project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V645 The 'strncat' function call could lead to the 'plugin_file' buffer overflow. The bounds should not contain the size of the buffer, but a number of characters it can hold. icuplug.c 739
  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