diff options
author | Joel Teichroeb | 2013-10-27 13:04:18 -0700 |
---|---|---|
committer | D G Turner | 2013-11-14 15:23:01 +0000 |
commit | 51dceaf1659ecc8ef3371f3a2fa26ca137403447 (patch) | |
tree | 11e40f1443ac56a2c38db817091c2dbfb0dcf9bb /gui/console.h | |
parent | 0ccc9189402de806307ca9836196cf29f31b2ab7 (diff) | |
download | scummvm-rg350-51dceaf1659ecc8ef3371f3a2fa26ca137403447.tar.gz scummvm-rg350-51dceaf1659ecc8ef3371f3a2fa26ca137403447.tar.bz2 scummvm-rg350-51dceaf1659ecc8ef3371f3a2fa26ca137403447.zip |
GUI: Use Common::String for console history, to ensure buffer safety.
Previously, if the user enters a command that is more than 256
characters, it will overflow the history buffer.
By using a Common::String, this is not possible.
Diffstat (limited to 'gui/console.h')
-rw-r--r-- | gui/console.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gui/console.h b/gui/console.h index 50a00a1ad1..194bfd6fc0 100644 --- a/gui/console.h +++ b/gui/console.h @@ -23,6 +23,7 @@ #define CONSOLE_DIALOG_H #include "gui/dialog.h" +#include "common/str.h" namespace GUI { @@ -69,7 +70,6 @@ protected: enum { kBufferSize = 32768, kCharsPerLine = 128, - kLineBufferSize = 256, kHistorySize = 20 }; @@ -112,7 +112,7 @@ protected: CompletionCallbackProc _completionCallbackProc; void *_completionCallbackRefCon; - char _history[kHistorySize][kLineBufferSize]; + Common::String _history[kHistorySize]; int _historySize; int _historyIndex; int _historyLine; @@ -184,7 +184,7 @@ protected: void killLastWord(); // History - void addToHistory(const char *str); + void addToHistory(const Common::String &str); void historyScroll(int direction); }; |