pkg/extend fix panic for empty partition tables (#4101)

Signed-off-by: Chris Irrgang <chris.irrgang@gmx.de>
This commit is contained in:
Chris Irrgang
2025-01-30 14:55:14 +01:00
committed by GitHub
parent 66ca00915a
commit 7ac34a6aec
5 changed files with 9 additions and 4 deletions

View File

@@ -82,6 +82,11 @@ func extend(d, fsType string) error {
return fmt.Errorf("Unable to unmarshal partition table from sfdisk: %v", err)
}
if len(f.PartitionTable.Partitions) == 0 {
log.Printf("Disk %s has no partitions. Skipping", d)
return nil
}
if len(f.PartitionTable.Partitions) > 1 {
log.Printf("Disk %s has more than 1 partition. Skipping", d)
return nil