- MAXIMUM_VOLUME_LABEL_LENGTH is in bytes, not in characters. Fix struct definition and access beyond the buffer. Spotted by Carlo Bramini.
- Trim trailing spaces from the volume label name, instead of stopping at the first encountered space. Fix by Carlo Bramini.
See issue #5505 for more details.

svn path=/trunk/; revision=48468
This commit is contained in:
Aleksey Bragin 2010-08-05 21:57:02 +00:00
parent cf3a6fe7c5
commit 50a341134c
2 changed files with 15 additions and 2 deletions

View file

@ -142,7 +142,7 @@ typedef struct _CDINFO
ULONG JolietLevel;
ULONG RootStart;
ULONG RootSize;
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH];
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
ULONG VolumeLabelLength;
ULONG SerialNumber;
} CDINFO, *PCDINFO;

View file

@ -73,11 +73,24 @@ CdfsGetPVDData(PUCHAR Buffer,
/* Extract the volume label */
pc = Pvd->VolumeId;
pw = CdInfo->VolumeLabel;
for (i = 0; i < MAXIMUM_VOLUME_LABEL_LENGTH && *pc != ' '; i++)
for (i = 0; i < MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR); i++)
{
*pw++ = (WCHAR)*pc++;
}
*pw = 0;
/* Trim trailing spaces */
while (pw > CdInfo->VolumeLabel)
{
if (*--pw != ' ') break;
/* Remove the space */
*pw = '\0';
/* Decrease size */
i--;
}
CdInfo->VolumeLabelLength = i * sizeof(WCHAR);
CdInfo->VolumeSpaceSize = Pvd->VolumeSpaceSizeL;