From cd15c394ccd9b786685c058059ffa386af8e8439 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Wed, 4 Dec 2013 10:05:33 +0100 Subject: [PATCH] * grub-core/osdep/windows/emuconsole.c (grub_console_putchar): Remove variable length arrays. * grub-core/term/efi/console.c (grub_console_putchar): Likewise. --- ChangeLog | 6 ++++++ grub-core/osdep/windows/emuconsole.c | 4 ++-- grub-core/term/efi/console.c | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 277258148..649e86699 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-12-04 Vladimir Serbinenko + + * grub-core/osdep/windows/emuconsole.c (grub_console_putchar): + Remove variable length arrays. + * grub-core/term/efi/console.c (grub_console_putchar): Likewise. + 2013-12-04 Vladimir Serbinenko * grub-core/kern/i386/qemu/init.c: Remove variable length arrays. diff --git a/grub-core/osdep/windows/emuconsole.c b/grub-core/osdep/windows/emuconsole.c index a2acf2637..8d7483c3f 100644 --- a/grub-core/osdep/windows/emuconsole.c +++ b/grub-core/osdep/windows/emuconsole.c @@ -37,7 +37,7 @@ static void grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), const struct grub_unicode_glyph *c) { - TCHAR str[2 + c->ncomb]; + TCHAR str[2 + 30]; unsigned i, j; DWORD written; @@ -47,7 +47,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), else str[0] = (c->base & 0xffff); j = 1; - for (i = 0; i < c->ncomb; i++) + for (i = 0; i < c->ncomb && j+1 < ARRAY_SIZE (str); i++) if (c->base < 0xffff) str[j++] = grub_unicode_get_comb (c)[i].code; str[j] = 0; diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c index a000fa648..a37eb841c 100644 --- a/grub-core/term/efi/console.c +++ b/grub-core/term/efi/console.c @@ -69,7 +69,7 @@ static void grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), const struct grub_unicode_glyph *c) { - grub_efi_char16_t str[2 + c->ncomb]; + grub_efi_char16_t str[2 + 30]; grub_efi_simple_text_output_interface_t *o; unsigned i, j; @@ -84,7 +84,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), else str[0] = (grub_efi_char16_t) map_char (c->base & 0xffff); j = 1; - for (i = 0; i < c->ncomb; i++) + for (i = 0; i < c->ncomb && j + 1 < ARRAY_SIZE (str); i++) if (c->base < 0xffff) str[j++] = grub_unicode_get_comb (c)[i].code; str[j] = 0;