[parted-devel] [PATCH 12/24] hfs: Fix gcc 10 bounds check warning

Brian C. Lane bcl at redhat.com
Sat Nov 14 00:11:55 GMT 2020


binfo is actually a list of structs that cannot be known until runtime,
so use a variable length array.
---
 libparted/fs/hfs/hfs.h   | 2 +-
 libparted/fs/r/hfs/hfs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libparted/fs/hfs/hfs.h b/libparted/fs/hfs/hfs.h
index 4fa2e95..0a9392a 100644
--- a/libparted/fs/hfs/hfs.h
+++ b/libparted/fs/hfs/hfs.h
@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader {
         uint32_t        bytes_used;
         uint32_t        checksum;
         uint32_t        pad;
-        HfsJBlockInfo   binfo[1];
+        HfsJBlockInfo   binfo[];
 };
 typedef struct _HfsJBlockListHeader HfsJBlockListHeader;
 
diff --git a/libparted/fs/r/hfs/hfs.h b/libparted/fs/r/hfs/hfs.h
index 4fa2e95..0a9392a 100644
--- a/libparted/fs/r/hfs/hfs.h
+++ b/libparted/fs/r/hfs/hfs.h
@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader {
         uint32_t        bytes_used;
         uint32_t        checksum;
         uint32_t        pad;
-        HfsJBlockInfo   binfo[1];
+        HfsJBlockInfo   binfo[];
 };
 typedef struct _HfsJBlockListHeader HfsJBlockListHeader;
 
-- 
2.26.2




More information about the parted-devel mailing list