PVS-StudioWarnings

PVS-Studio warning V527 for Apache

Nov 19th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. typedef struct {
  2.     const char* (*func)(request_rec *r,char *arg);
  3.     char *arg;
  4. } format_tag;
  5.  
  6. static char *parse_format_tag(apr_pool_t *p,
  7.                               format_tag *tag,
  8.                               const char **sa)
  9. {
  10.   ...
  11.   tag->arg = '\0';
  12.   ...
  13. }
  14.  
  15. This is what should have been written here: tag->arg = NULL; or tag->arg[0] = '\0';.
  16.  
  17. This suspicious code was found in Apache project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *tag->arg = '\0'. mod_headers mod_headers.c 330
  20.  
  21. 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