summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-31 12:51:56 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-31 12:52:59 (GMT)
commitb6d116e240dc4ae2fb63d24de0efbdd891b74fe6 (patch)
tree2c0c8083dddee8f254d35b8840eeddd9250d80a2
parentc31d9f1c30bddef091517a777936362a403b49b2 (diff)
downloadCMake-b6d116e240dc4ae2fb63d24de0efbdd891b74fe6.zip
CMake-b6d116e240dc4ae2fb63d24de0efbdd891b74fe6.tar.gz
CMake-b6d116e240dc4ae2fb63d24de0efbdd891b74fe6.tar.bz2
cmCursesLongMessageForm: Avoid -Wstringop-overflow warning
We use `strncpy` to copy the title up to a maximum number of characters. GCC 8's `-Wstringop-overflow` warns that the length depends on the input length because it fails to recognize that we are bounding it to the buffer size too. Update the code to hide the dependence on the input length.
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 9bd1c11..a41d051 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -43,7 +43,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
getmaxyx(stdscr, y, x);
char bar[cmCursesMainForm::MAX_WIDTH];
- size_t size = strlen(this->Title.c_str());
+ size_t size = this->Title.size();
if (size >= cmCursesMainForm::MAX_WIDTH) {
size = cmCursesMainForm::MAX_WIDTH - 1;
}