From edf2395b199da9e971e8232ffe82f1ffb4a81c29 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 19 Nov 2023 21:07:25 +0100 Subject: [PATCH] Fix out-of-bounds read in OSX disk checking (#2658). --- src/lib/cross_common.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/cross_common.cc b/src/lib/cross_common.cc index e8c209b21..b4d322096 100644 --- a/src/lib/cross_common.cc +++ b/src/lib/cross_common.cc @@ -172,7 +172,7 @@ osx_disks_to_drives (vector disks) continue; } for (auto& j: disks) { - if (!j.mount_points.empty() && starts_with(j.device, i.device)) { + if (&i != &j && !j.mount_points.empty() && starts_with(j.device, i.device)) { LOG_DISK("Marking %1 as mounted because %2 is", i.device, j.device); std::copy(j.mount_points.begin(), j.mount_points.end(), back_inserter(i.mount_points)); } -- 2.30.2