diff --git a/.pvsconfig b/.pvsconfig index 70fdcde8a9..df665de4df 100644 --- a/.pvsconfig +++ b/.pvsconfig @@ -88,8 +88,6 @@ //-V::1071 # Conditional initialization inside the constructor may leave some members uninitialized. //-V::1077 -# Call of the 'Foo' function will lead to buffer underflow. -//-V::1086 # Waiting on condition variable without predicate. A thread can wait indefinitely or experience a spurious wake-up. //-V::1089 # The 'emplace' / 'insert' function call contains potentially dangerous move operation. Moved object can be destroyed even if there is no insertion. diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 6b465c1512..74089e528a 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -314,9 +314,12 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) char secondLine[512] = ""; char thirdLine[512] = ""; if (process) { - memset(firstLine, ' ', 68); - memset(secondLine, ' ', 68); - memset(thirdLine, ' ', 68); + std::fill_n(firstLine, 68, ' '); + firstLine[68] = '\0'; + std::fill_n(secondLine, 68, ' '); + secondLine[68] = '\0'; + std::fill_n(thirdLine, 68, ' '); + thirdLine[68] = '\0'; } else { if (this->OkToGenerate) { snprintf(firstLine, sizeof(firstLine), @@ -340,7 +343,8 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) move(y - 4, 0); char fmt[512] = "Keys: [enter] Edit an entry [d] Delete an entry"; if (process) { - memset(fmt, ' ', 57); + std::fill_n(fmt, 57, ' '); + fmt[57] = '\0'; } printw(fmt_s, fmt); move(y - 3, 0); diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index a901ab2ad2..54a65c8280 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -246,7 +246,8 @@ static bool testUVStreambufRead( << std::endl; goto end; } - if (std::memcmp(inputData.data(), outputData, 64)) { + if (std::memcmp(inputData.data(), outputData, //-V1086 Ignore underflow + 64)) { std::cout << "Read data does not match write data" << std::endl; goto end; }