summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2019-04-09 02:43:20 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2019-04-09 02:43:20 +0100
commit5e854d5060e4874d27049cda500535bb7eabe6d9 (patch)
tree6f710a51601723a4e4b716235cba11c919e705ac
parentb72dc79eec3d369a38202522165f5ef4cfa5b98b (diff)
downloadmdk-5e854d5060e4874d27049cda500535bb7eabe6d9.tar.gz
mdk-5e854d5060e4874d27049cda500535bb7eabe6d9.tar.bz2
GTK Console input no longer overruns buffer
Patch by Kevin Brunelle The console input in gmixvm will only read 70 characters, but the outer loop used 70 (the characters) instead of 14 (the number of words). This caused the VM to read past the end of the buffer and write 56 words of junk into the emulator.
-rw-r--r--mixgtk/mixgtk_device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mixgtk/mixgtk_device.c b/mixgtk/mixgtk_device.c
index 0cae037..1d28b6e 100644
--- a/mixgtk/mixgtk_device.c
+++ b/mixgtk/mixgtk_device.c
@@ -236,7 +236,7 @@ read_cons_ (mix_word_t *block)
if (result == GTK_RESPONSE_OK)
{
text = g_strdup_printf ("%-70s", gtk_entry_get_text (input_dlg_entry_));
- for (i = 0; i < 70; ++i)
+ for (i = 0; i < SIZES_[mix_dev_CONSOLE]; ++i)
for (j = 0; j < 5; ++j)
mix_word_set_byte (block + i, j + 1,
mix_char_to_byte