From b132272fb1da66234a3549f1d936ec1d8113ee0f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 16 Nov 2019 21:44:02 +0000 Subject: [PATCH] Fix give money number parsing when input value is greater than INT32_MAX See: https://github.com/OpenTTD/OpenTTD/issues/7750 --- src/company_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 8bd575f641..4f2dd2660e 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -2687,7 +2687,7 @@ struct CompanyWindow : Window default: NOT_REACHED(); case WID_C_GIVE_MONEY: - DoCommandP(0, (atoi(str) / _currency->rate), this->window_number, CMD_GIVE_MONEY | CMD_MSG(STR_ERROR_INSUFFICIENT_FUNDS), CcGiveMoney, str); + DoCommandP(0, (strtoull(str, nullptr, 10) / _currency->rate), this->window_number, CMD_GIVE_MONEY | CMD_MSG(STR_ERROR_INSUFFICIENT_FUNDS), CcGiveMoney, str); break; case WID_C_PRESIDENT_NAME: