PVS-StudioWarnings

PVS-Studio warning V527 for TPP

Nov 19th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. RAMPREAL *readPeaks(RAMPFILE *pFI,
  2.       ramp_fileoffset_t lScanIndex)
  3. {
  4.   ...
  5.   else
  6.   {
  7.     const char* pEndAttrValue;
  8.     pEndAttrValue =
  9.       strchr(pBeginData + strlen("contentType=\"") + 1, '\"');
  10.     pEndAttrValue  = '\0';
  11.     fprintf(stderr, "%s Unsupported content type\n",
  12.             pBeginData);
  13.     return NULL;
  14.   }
  15.   ...
  16. }
  17.  
  18. This is what should have been written here: *pEndAttrValue = '\0';
  19.  
  20.  
  21. This suspicious code was found in TPP project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V527 It is odd that the '\0' value is assigned to 'char' type pointer. Probably meant: *pEndAttrValue = '\0'. tpplib ramp.cpp 1856
  24.  
  25. 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