VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-08-14 23:24:30 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-08-15 14:44:32 +0200
commit6cdcbac305bb34b90d0864879ce940463fae9730 (patch)
tree27c5749f0ca7b0edc4e7795ca44ee3e9f30f7c50 /src
parent17af27bc7fa82030084c3c3065f9516bfb88a899 (diff)
downloadVeraCrypt-6cdcbac305bb34b90d0864879ce940463fae9730.tar.gz
VeraCrypt-6cdcbac305bb34b90d0864879ce940463fae9730.zip
WIndows driver: add check for failed memory allocation
Diffstat (limited to 'src')
-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 fca2ca42..e7451a8f 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)
{