فهرست منبع

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.
Brad King 7 سال پیش
والد
کامیت
b6d116e240
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      Source/CursesDialog/cmCursesLongMessageForm.cxx

+ 1 - 1
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;
   }