From 07cdbff27ca80a6e1f8f66f67c0f13c9521a98c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= Date: Mon, 5 Feb 2018 05:53:51 +0000 Subject: [PATCH] Fix commit 1f16f06 not use array with limited size --- src/Score.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Score.cpp b/src/Score.cpp index e7cb9ea3..0ecd44a2 100644 --- a/src/Score.cpp +++ b/src/Score.cpp @@ -11,6 +11,7 @@ for current ball. 20171209 c30zD : Correctly display the "reset" and "launch" keys. 20171213 c30zD : Fix previous strings for gettext usage. + 20170209 sergiomb2 : Fix previous not use array with limited size ***************************************************************************/ @@ -85,11 +86,11 @@ void Score::onTick() { void Score::StdOnSignal() { EM_COUT((int)em_signal, 1); Config *cfg = Config::getInstance(); - char pStrMsg[35]; + char *pStrMsg; OnSignal( PBL_SIG_RESET_ALL ) { this->clear(); - sprintf(pStrMsg, gettext("press %s to launch ball"), cfg->getKeyCommonName(cfg->getKey("launch"))); + asprintf(&pStrMsg, gettext("press %s to launch ball"), cfg->getKeyCommonName(cfg->getKey("launch"))); this->setText1(pStrMsg); SendSignal( PBL_SIG_CLEAR_TEXT, 400, this->getParent(), NULL ); } @@ -117,7 +118,6 @@ void Score::StdOnSignal() { } ElseOnSignal( PBL_SIG_GAME_OVER ) { this->clearText(); - sprintf(pStrMsg, gettext("press %s to start new game"), cfg->getKeyCommonName(cfg->getKey("reset"))); //cout<<" TODO:give (only) one extra ball if high score"<setText2(""); this->setText3(gettext("game over")); + asprintf(&pStrMsg, gettext("press %s to start new game"), cfg->getKeyCommonName(cfg->getKey("reset"))); this->setText4(pStrMsg); } }