]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/iso9660.c: Remove variable length arrays.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 20 Oct 2013 14:21:02 +0000 (16:21 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 20 Oct 2013 14:21:02 +0000 (16:21 +0200)
Increases iso9660.mod by 200 bytes (but decreases by 79 compressed when
compressed).

ChangeLog
grub-core/fs/iso9660.c

index 63dbdb333596437b76ae13b3efe5d021f6cc43fb..5382a03e474a7573da96511b90830f33db21ae02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
+2013-10-20  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/iso9660.c: Remove variable length arrays.
+       Increases iso9660.mod by 200 bytes (but decreases by 79 compressed when
+       compressed).
+
 2013-10-20  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/nilfs2.c: Remove variable length arrays.
-       Increases xfs.mod by 24 bytes (but decreases by 115 compressed when
+       Increases nilfs2.mod by 24 bytes (but decreases by 115 compressed when
        compressed).
 
 2013-10-20  Vladimir Serbinenko  <phcoder@gmail.com>
index cdbd6dc36add4b824be49316e90abffa923ae108..731c024dd6668729341ea5b2d9ea987b97ab67f0 100644 (file)
@@ -79,6 +79,7 @@ struct grub_iso9660_dir
   struct grub_iso9660_date2 mtime;
   grub_uint8_t flags;
   grub_uint8_t unused2[6];
+#define MAX_NAMELEN 255
   grub_uint8_t namelen;
 } __attribute__ ((packed));
 
@@ -328,11 +329,11 @@ grub_iso9660_convert_string (grub_uint8_t *us, int len)
 {
   char *p;
   int i;
-  grub_uint16_t t[len];
+  grub_uint16_t t[MAX_NAMELEN / 2 + 1];
 
   p = grub_malloc (len * GRUB_MAX_UTF8_PER_UTF16 + 1);
   if (! p)
-    return p;
+    return NULL;
 
   for (i=0; i<len; i++)
     t[i] = grub_be_to_cpu16 (grub_get_unaligned16 (us + 2 * i));
@@ -680,7 +681,7 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
        }
 
       {
-       char name[dirent.namelen + 1];
+       char name[MAX_NAMELEN + 1];
        int nameoffset = offset + sizeof (dirent);
        struct grub_fshelp_node *node;
        int sua_off = (sizeof (dirent) + dirent.namelen + 1