From b6d116e240dc4ae2fb63d24de0efbdd891b74fe6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 31 Jul 2018 08:51:56 -0400 Subject: 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. --- Source/CursesDialog/cmCursesLongMessageForm.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v0.12