PVS-StudioWarnings

PVS-Studio warning V579 for Chromium

Nov 10th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. std::string TestFileIO::TestParallelReads() {
  2.   ...
  3.   const char* expected_result_1 =
  4.     "__border__abc__border__";
  5.   const char* expected_result_2 =
  6.     "__border__defghijkl__border__";
  7.   if (strncmp(extended_buf_1, expected_result_1,
  8.               sizeof(expected_result_1)) != 0 ||
  9.       strncmp(extended_buf_2, expected_result_2,
  10.               sizeof(expected_result_2)) != 0) {
  11.   ...
  12. }
  13.  
  14. This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V579 The strncmp function receives the pointer and its size as arguments. It is possibly a mistake. Inspect the third argument. ppapi_tests test_file_io.cc 759
  17.  
  18. 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