PVS-StudioWarnings

PVS-Studio warning V692 for Wine

Nov 11th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. static void on_remove_app_click(HWND dialog)
  2. {
  3.   ....
  4.   section[strlen(section)] = '\0'; /* remove last backslash  */
  5.   ....
  6. }
  7.  
  8. NULL is written to NULL. Backslash will not be removed.
  9.  
  10. This suspicious code was found in Wine project by PVS-Studio static code analyzer.
  11. Warning message is:
  12. V692 An inappropriate attempt to append a null character to a string. To determine the length of a string by 'strlen' function correctly, a string ending with a null terminator should be used in the first place. appdefaults.c 390
  13.  
  14. 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