Fix out-of-bounds read in OSX disk checking (#2658).
[dcpomatic.git] / src / lib / cross_common.cc
index e8c209b21e098f8da981bd5676af55c0c00b65ab..b4d322096a5645f3bf7f7fd5c09d40f94279b3ef 100644 (file)
@@ -172,7 +172,7 @@ osx_disks_to_drives (vector<OSXDisk> 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));
                        }