|
|
edefaa |
From 86594612f8ae4dbc416e3cd1bc8bb05445df09e5 Mon Sep 17 00:00:00 2001
|
|
|
edefaa |
From: "Brian C. Lane" <bcl@redhat.com>
|
|
|
edefaa |
Date: Fri, 11 Jun 2021 12:05:22 -0700
|
|
|
edefaa |
Subject: [PATCH 12/13] libparted: Fix warning about buffer size in Atari label
|
|
|
edefaa |
|
|
|
edefaa |
When the Atari table is empty it copies 'PARTEDATARI' into the id, and
|
|
|
edefaa |
the start and size bytes. This can be confusion, so turn it into a
|
|
|
edefaa |
union of the string and the non-empty values.
|
|
|
edefaa |
---
|
|
|
edefaa |
libparted/labels/atari.c | 17 +++++++++++------
|
|
|
edefaa |
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
edefaa |
|
|
|
edefaa |
diff --git a/libparted/labels/atari.c b/libparted/labels/atari.c
|
|
|
edefaa |
index 7923487..2ac03d2 100644
|
|
|
edefaa |
--- a/libparted/labels/atari.c
|
|
|
edefaa |
+++ b/libparted/labels/atari.c
|
|
|
edefaa |
@@ -137,9 +137,14 @@ static AtariFS2PartId atr_fs2pid[] = {
|
|
|
edefaa |
|
|
|
edefaa |
struct __attribute__ ((packed)) _AtariRawPartition {
|
|
|
edefaa |
uint8_t flag; /* bit 0: active; bit 7: bootable */
|
|
|
edefaa |
- uint8_t id[3]; /* "GEM", "BGM", "XGM", ... */
|
|
|
edefaa |
- uint32_t start; /* start of partition */
|
|
|
edefaa |
- uint32_t size; /* length of partition */
|
|
|
edefaa |
+ union {
|
|
|
edefaa |
+ uint8_t empty[11]; /* Empty table */
|
|
|
edefaa |
+ struct __attribute__ ((packed)) {
|
|
|
edefaa |
+ uint8_t id[3]; /* "GEM", "BGM", "XGM", ... */
|
|
|
edefaa |
+ uint32_t start; /* start of partition */
|
|
|
edefaa |
+ uint32_t size; /* length of partition */
|
|
|
edefaa |
+ };
|
|
|
edefaa |
+ };
|
|
|
edefaa |
};
|
|
|
edefaa |
typedef struct _AtariRawPartition AtariRawPartition;
|
|
|
edefaa |
|
|
|
edefaa |
@@ -241,8 +246,8 @@ static int
|
|
|
edefaa |
atr_is_signature_entry (AtariRawPartition* part)
|
|
|
edefaa |
{
|
|
|
edefaa |
return part->flag == 0
|
|
|
edefaa |
- && !memcmp (part->id, SIGNATURE_EMPTY_TABLE,
|
|
|
edefaa |
- SIGNATURE_EMPTY_SIZE );
|
|
|
edefaa |
+ && !memcmp (part->empty, SIGNATURE_EMPTY_TABLE,
|
|
|
edefaa |
+ SIGNATURE_EMPTY_SIZE );
|
|
|
edefaa |
}
|
|
|
edefaa |
|
|
|
edefaa |
/* Set Parted signature in an AHDI entry */
|
|
|
edefaa |
@@ -250,7 +255,7 @@ static void
|
|
|
edefaa |
atr_put_signature_entry (AtariRawPartition* part)
|
|
|
edefaa |
{
|
|
|
edefaa |
part->flag = 0;
|
|
|
edefaa |
- memcpy (part->id, SIGNATURE_EMPTY_TABLE, SIGNATURE_EMPTY_SIZE);
|
|
|
edefaa |
+ memcpy (part->empty, SIGNATURE_EMPTY_TABLE, SIGNATURE_EMPTY_SIZE);
|
|
|
edefaa |
}
|
|
|
edefaa |
|
|
|
edefaa |
#define atr_part_known(part, pid_list) (atr_pid_known ((part)->id, pid_list))
|
|
|
edefaa |
--
|
|
|
edefaa |
2.31.1
|
|
|
edefaa |
|