Browse Source

ccmake: fix status line buffer overflow on very wide terminals

A mistyped length calculation will memset across stack frame when
the user's terminal width is larger than 270.
Tianhao Chai 7 years ago
parent
commit
7899e53691
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Source/CursesDialog/cmCursesMainForm.cxx

+ 1 - 1
Source/CursesDialog/cmCursesMainForm.cxx

@@ -475,7 +475,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message)
       strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2);
       if (curFieldLen + helpLen + 2 < width) {
         memset(bar + curFieldLen + helpLen + 2, ' ',
-               width - curFieldLen + helpLen + 2);
+               width - (curFieldLen + helpLen + 2));
       }
     }
   }