From 5fa54ce78b4ee0f7c7b038a55b5b83a333c6934c Mon Sep 17 00:00:00 2001 From: that Date: Sun, 1 Feb 2015 16:15:29 +0100 Subject: gui: fix potential invalid memory access A single char should never be treated as a string. Change-Id: I5f8459495f7d0f907ac7c0ae6dd73a3428d92d23 --- gui/input.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gui/input.cpp b/gui/input.cpp index 84ee17b16..bb7bdf853 100644 --- a/gui/input.cpp +++ b/gui/input.cpp @@ -714,11 +714,7 @@ int GUIInput::NotifyKeyboard(int key) if (mCursorLocation == -1) { variableValue += key; } else { - const char newchar = (char)key; - const char* a = &newchar; - string newstring = a; - newstring.resize(1); - variableValue.insert(mCursorLocation + skipChars, newstring); + variableValue.insert(mCursorLocation + skipChars, 1, key); mCursorLocation++; } isLocalChange = true; -- cgit v1.2.3