1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

ccmake: Check that getmaxyx result width is non-negative

Otherwise GCC 10.1 issues a `-Wstringop-overflow=` diagnostic when
we use the width for indexing.
This commit is contained in:
Brad King
2020-05-19 15:40:45 -04:00
parent 2f3a356ea8
commit 3aede31cfc

View File

@@ -68,7 +68,7 @@ void cmCursesLongMessageForm::UpdateStatusBar()
bar[i] = ' ';
}
int width;
if (x < cmCursesMainForm::MAX_WIDTH) {
if (x >= 0 && x < cmCursesMainForm::MAX_WIDTH) {
width = x;
} else {
width = cmCursesMainForm::MAX_WIDTH - 1;