Index: drivers/filesystems/cdfs/fsctl.c =================================================================== --- drivers/filesystems/cdfs/fsctl.c (revision 48006) +++ drivers/filesystems/cdfs/fsctl.c (working copy) @@ -73,11 +73,27 @@ /* Extract the volume label */ pc = Pvd->VolumeId; pw = CdInfo->VolumeLabel; - for (i = 0; i < MAXIMUM_VOLUME_LABEL_LENGTH && *pc != ' '; i++) + for (i = 0; i < sizeof(Pvd->VolumeId); i++) { *pw++ = (WCHAR)*pc++; } - *pw = 0; + + /* Can be done because MAXIMUM_VOLUME_LABEL_LENGTH > sizeof(Pvd->VolumeId) */ + *pw = '\0'; + + /* Now trim spaces on the right side */ + while (pw > CdInfo->VolumeLabel) + { + if (*--pw == ' ') + { + /* Remove the space */ + *pw = '\0'; + /* Decrease size */ + i--; + } else + break; + } + CdInfo->VolumeLabelLength = i * sizeof(WCHAR); CdInfo->VolumeSpaceSize = Pvd->VolumeSpaceSizeL;