* grub-core/osdep/windows/emuconsole.c (grub_console_putchar):

Remove variable length arrays.
	* grub-core/term/efi/console.c (grub_console_putchar): Likewise.
This commit is contained in:
Vladimir Serbinenko 2013-12-04 10:05:33 +01:00
parent bb6e299ccb
commit cd15c394cc
3 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <phcoder@gmail.com> 2013-12-04 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/i386/qemu/init.c: Remove variable length arrays. * grub-core/kern/i386/qemu/init.c: Remove variable length arrays.

View file

@ -37,7 +37,7 @@ static void
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
const struct grub_unicode_glyph *c) const struct grub_unicode_glyph *c)
{ {
TCHAR str[2 + c->ncomb]; TCHAR str[2 + 30];
unsigned i, j; unsigned i, j;
DWORD written; DWORD written;
@ -47,7 +47,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
else else
str[0] = (c->base & 0xffff); str[0] = (c->base & 0xffff);
j = 1; 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) if (c->base < 0xffff)
str[j++] = grub_unicode_get_comb (c)[i].code; str[j++] = grub_unicode_get_comb (c)[i].code;
str[j] = 0; str[j] = 0;

View file

@ -69,7 +69,7 @@ static void
grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)), grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
const struct grub_unicode_glyph *c) 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; grub_efi_simple_text_output_interface_t *o;
unsigned i, j; unsigned i, j;
@ -84,7 +84,7 @@ grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
else else
str[0] = (grub_efi_char16_t) map_char (c->base & 0xffff); str[0] = (grub_efi_char16_t) map_char (c->base & 0xffff);
j = 1; 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) if (c->base < 0xffff)
str[j++] = grub_unicode_get_comb (c)[i].code; str[j++] = grub_unicode_get_comb (c)[i].code;
str[j] = 0; str[j] = 0;