mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-17 18:16:07 -05:00
OpenBSD: fix device-hosted volume sizing
OpenBSD device length detection was returning the raw disk sector count from DIOCGPDINFO directly. That value is not bytes and it describes the physical/default disk label, which caused VeraCrypt to expose an incorrectly sized FUSE backing image through vnd for device-hosted volumes. Use the current disklabel from DIOCGDINFO, derive the opened partition from the device minor number, and return the selected partition size in bytes. Keep the raw c partition on the whole-disk path by using DL_GETDSIZE there. Also reject sector-misaligned device-hosted sizes during volume creation so new malformed OpenBSD device-hosted volumes are not created. Do not reject existing malformed headers at mount time, so users can still mount old OpenBSD-created volumes for recovery. Refs #1589. Refs #1593.
This commit is contained in:
@@ -282,6 +282,9 @@ namespace VeraCrypt
|
||||
{
|
||||
throw UnsupportedSectorSize (SRC_POS);
|
||||
}
|
||||
|
||||
if (HostSize % options->SectorSize != 0)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
}
|
||||
else
|
||||
options->SectorSize = TC_SECTOR_SIZE_FILE_HOSTED_VOLUME;
|
||||
|
||||
Reference in New Issue
Block a user