mirror of
https://github.com/reactos/reactos.git
synced 2025-07-30 19:31:37 +00:00
[CDFS]
- 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:
parent
cf3a6fe7c5
commit
50a341134c
2 changed files with 15 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue