Advertisement
PVS-StudioWarnings

PVS-Studio warning V528 for TortoiseGIT

Nov 27th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. void
  2. svn_path_splitext(const char **path_root,
  3.                   const char **path_ext,
  4.                   const char *path,
  5.                   apr_pool_t *pool)
  6. {
  7.   const char *last_dot;
  8.   ....
  9.   last_dot = strrchr(path, '.');
  10.   if (last_dot && (last_dot + 1 != '\0'))
  11.   ....
  12. }
  13.  
  14. Most likely this is what should be written here: "if (last_dot && (*(last_dot + 1) != '\0'))" or "if (last_dot && last_dot[1] != '\0')".
  15.  
  16. This suspicious code was found in TortoiseGIT project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V528 It is odd that pointer to 'char' type is compared with the '\0' value. Probably meant: *last_dot + 1 != '\0'. path.c 1258
  19.  
  20. 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