lshw/lshw-fix-segfault-in-apfs-volume-code.patch
2020-04-24 18:22:55 +02:00

30 lines
881 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] 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 e703523..6fce2ee 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;