diff options
author | James Brown | 2002-12-16 03:21:38 +0000 |
---|---|---|
committer | James Brown | 2002-12-16 03:21:38 +0000 |
commit | 4c831704cdab662a7e16e4ec7a900ed08b793437 (patch) | |
tree | 47d11a4027f070899f2d6b42967b7686529148d7 /gui | |
parent | 48a9679c1934ba3f6e861c3fbe20d6b7489c877e (diff) | |
download | scummvm-rg350-4c831704cdab662a7e16e4ec7a900ed08b793437.tar.gz scummvm-rg350-4c831704cdab662a7e16e4ec7a900ed08b793437.tar.bz2 scummvm-rg350-4c831704cdab662a7e16e4ec7a900ed08b793437.zip |
Fix segfault
svn-id: r5988
Diffstat (limited to 'gui')
-rw-r--r-- | gui/console.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gui/console.cpp b/gui/console.cpp index c2abf26438..ef8aa12a26 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -154,6 +154,9 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) int len = _promptEndPos - _promptStartPos; char str[len + 1]; + + if (len < 0) len = 0; // Prevent overflow from forced Ctrl-D deletion + for (i = 0; i < len; i++) str[i] = _buffer[(_promptStartPos + i) % kBufferSize]; str[len] = '\0'; |