#2 crash if no mount point

open
nobody
None
5
2009-02-27
2009-02-27
scp
No

If a partition has no drive letter or mount point the GetMountPoint() is empty and GetIndexOfDrive() crashes.
In this case DeviceName should be used instead.

--- orig\ODINDlg.cpp Thu Jan 15 21:58:38 2009
+++ ODINDlg.cpp Fri Feb 27 18:38:36 2009
@@ -1426,11 +1426,24 @@
fOdinManager.MakeSnapshot(index);
}

+ const CDriveList* tempDriveList = fOdinManager.GetDriveList();
for (int i=0; i<subPartitions; i++) {
DisableControlsWhileProcessing();
GenerateFileNameForEntireDiskBackup(volumeFileName, fileName, pContainedVolumes[i]->GetDeviceName());

- fOdinManager.SavePartition(fOdinManager.GetDriveList()->GetIndexOfDrive(pContainedVolumes[i]->GetMountPoint().c_str()),
+ wstring volumeMountPoint = pContainedVolumes[i]->GetMountPoint();
+ int volumeIndex = -1;
+ if (volumeMountPoint.length())
+ {
+ volumeIndex = tempDriveList->GetIndexOfDrive(volumeMountPoint.c_str());
+ }
+ else
+ {
+ volumeMountPoint = pContainedVolumes[i]->GetDeviceName();
+ volumeIndex = tempDriveList->GetIndexOfDeviceName(volumeMountPoint.c_str());
+ }
+
+ fOdinManager.SavePartition(volumeIndex,
volumeFileName.c_str(), fOdinManager.GetSplitSize() ? &fSplitCB : NULL);
ATLTRACE(L"Found sub-partition: %s\n", pContainedVolumes[i]->GetDisplayName().c_str());
statusText.FormatMessageW(IDS_STATUS_BACKUP_DISK_PROGRESS, i, subPartitions);

Discussion