VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-08-14 21:24:30 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-08-15 12:44:32 (GMT)
commit6cdcbac305bb34b90d0864879ce940463fae9730 (patch)
tree27c5749f0ca7b0edc4e7795ca44ee3e9f30f7c50
parent17af27bc7fa82030084c3c3065f9516bfb88a899 (diff)
downloadVeraCrypt-6cdcbac305bb34b90d0864879ce940463fae9730.zip
VeraCrypt-6cdcbac305bb34b90d0864879ce940463fae9730.tar.gz
WIndows driver: add check for failed memory allocation
-rw-r--r--src/Driver/Ntdriver.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index fca2ca4..e7451a8 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -3734,16 +3734,19 @@ NTSTATUS MountDevice (PDEVICE_OBJECT DeviceObject, MOUNT_STRUCT *mount)
IO_STATUS_BLOCK ioblock;
ULONG labelInfoSize = sizeof(FILE_FS_LABEL_INFORMATION) + (labelEffectiveLen * sizeof(WCHAR));
FILE_FS_LABEL_INFORMATION* labelInfo = (FILE_FS_LABEL_INFORMATION*) TCalloc (labelInfoSize);
- labelInfo->VolumeLabelLength = labelEffectiveLen * sizeof(WCHAR);
- memcpy (labelInfo->VolumeLabel, mount->wszLabel, labelInfo->VolumeLabelLength);
-
- if (STATUS_SUCCESS == ZwSetVolumeInformationFile (volumeHandle, &ioblock, labelInfo, labelInfoSize, FileFsLabelInformation))
+ if (labelInfo)
{
- mount->bDriverSetLabel = TRUE;
- NewExtension->bDriverSetLabel = TRUE;
- }
+ labelInfo->VolumeLabelLength = labelEffectiveLen * sizeof(WCHAR);
+ memcpy (labelInfo->VolumeLabel, mount->wszLabel, labelInfo->VolumeLabelLength);
+
+ if (STATUS_SUCCESS == ZwSetVolumeInformationFile (volumeHandle, &ioblock, labelInfo, labelInfoSize, FileFsLabelInformation))
+ {
+ mount->bDriverSetLabel = TRUE;
+ NewExtension->bDriverSetLabel = TRUE;
+ }
- TCfree(labelInfo);
+ TCfree(labelInfo);
+ }
}
__except (EXCEPTION_EXECUTE_HANDLER)
{