From ea9da30d8b45c5e45e5b7cd7cc8ae22b5fcfbfe7 Mon Sep 17 00:00:00 2001 From: MarkusVolk Date: Tue, 14 Jan 2020 08:55:44 +0100 Subject: [PATCH] menue.cpp: avoid unterminated strings Signed-off-by: MarkusVolk --- src/gui/widget/menue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 0ea808c89..4c41321af 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1866,7 +1866,7 @@ int CMenuOptionNumberChooser::exec(CMenuTarget*) int CMenuOptionNumberChooser::paint(bool selected) { const char * l_option; - char option_value[40]; + char option_value[41]; for (size_t i = 0; i < localized.size(); i++) { @@ -1874,7 +1874,7 @@ int CMenuOptionNumberChooser::paint(bool selected) { if (numberFormatFunction) { std::string s = numberFormatFunction(*optionValue + display_offset); - strncpy(option_value, s.c_str(), sizeof(option_value)); + strncpy(option_value, s.c_str(), sizeof(option_value)-1); } else sprintf(option_value, numberFormat.c_str(), *optionValue + display_offset); l_option = option_value;