diff --git a/ChangeLog b/ChangeLog index 659096fd3..943e6d89a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-10-20 Vladimir Serbinenko + + * grub-core/fs/ntfs.c: Remove variable length arrays. + Increases ntfs.mod by 64 bytes (but decreases by 3 when + compressed). + 2013-10-20 Vladimir Serbinenko * grub-core/fs/hfs.c: Remove variable length arrays. @@ -6,19 +12,19 @@ 2013-10-20 Vladimir Serbinenko * grub-core/fs/udf.c: Remove variable length arrays. - Increases udf.mod by 128 bytes (but decreases by 13 compressed when + Increases udf.mod by 128 bytes (but decreases by 13 when compressed). 2013-10-20 Vladimir Serbinenko * grub-core/fs/iso9660.c: Remove variable length arrays. - Increases iso9660.mod by 200 bytes (but decreases by 79 compressed when + Increases iso9660.mod by 200 bytes (but decreases by 79 when compressed). 2013-10-20 Vladimir Serbinenko * grub-core/fs/nilfs2.c: Remove variable length arrays. - Increases nilfs2.mod by 24 bytes (but decreases by 115 compressed when + Increases nilfs2.mod by 24 bytes (but decreases by 115 when compressed). 2013-10-20 Vladimir Serbinenko diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c index 5ea2e1bd7..d342e45c5 100644 --- a/grub-core/fs/ntfs.c +++ b/grub-core/fs/ntfs.c @@ -643,7 +643,7 @@ list_file (struct grub_ntfs_file *diro, grub_uint8_t *pos, if (ustr == NULL) return 0; { - grub_uint16_t tmp[ns]; + grub_uint16_t tmp[256]; int i; for (i = 0; i < ns; i++) tmp[i] = grub_le_to_cpu16 (grub_get_unaligned16 ((char *) np @@ -1185,18 +1185,24 @@ grub_ntfs_label (grub_device_t device, char **label) if ((pa) && (pa[8] == 0) && (u32at (pa, 0x10))) { grub_uint8_t *buf; + grub_uint16_t *tmp; int len; + int i; len = u32at (pa, 0x10) / 2; buf = grub_malloc (len * 4 + 1); + tmp = grub_malloc (len * 2); + if (!buf || !tmp) + { + grub_free (buf); + grub_free (tmp); + goto fail; + } pa += u16at (pa, 0x14); - { - grub_uint16_t tmp[len]; - int i; - for (i = 0; i < len; i++) - tmp[i] = grub_le_to_cpu16 (grub_get_unaligned16 (pa + 2 * i)); - *grub_utf16_to_utf8 (buf, tmp, len) = '\0'; - } + for (i = 0; i < len; i++) + tmp[i] = grub_le_to_cpu16 (grub_get_unaligned16 (pa + 2 * i)); + *grub_utf16_to_utf8 (buf, tmp, len) = '\0'; + grub_free (tmp); *label = (char *) buf; }