lshw/0012-volumes-fix-segfault-in-apfs-volume-code.patch

32 lines
908 B
Diff

From 82df4fa7d3705f2f61282ed5b22074d4e0a6efc4 Mon Sep 17 00:00:00 2001
From: Harry Mallon <hjmallon@gmail.com>
Date: Thu, 23 Apr 2020 21:18:47 +0100
Subject: [PATCH 12/17] volumes: fix segfault in apfs volume code
---
src/core/volumes.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/volumes.cc b/src/core/volumes.cc
index e70352377f84..6fce2ee3de1c 100644
--- a/src/core/volumes.cc
+++ b/src/core/volumes.cc
@@ -784,12 +784,13 @@ struct apfs_super_block {
static bool detect_apfs(hwNode & n, source & s)
{
- static char buffer[sizeof(apfs_super_block)];
+ static char buffer[APFS_STANDARD_BLOCK_SIZE];
source apfsvolume;
apfs_super_block *sb = (apfs_super_block*)buffer;
unsigned long block_size;
apfsvolume = s;
+ apfsvolume.blocksize = APFS_STANDARD_BLOCK_SIZE;
if(readlogicalblocks(apfsvolume, buffer, 0, 1)!=1)
return false;
--
2.17.1