Implemented a basic check on upcase table

PERMISSION_HANDLING_BRANCH
Jean-Pierre André 2010-10-26 08:59:51 +02:00
parent 8b910e9e80
commit 563f5dda3f
1 changed files with 12 additions and 0 deletions

View File

@ -868,6 +868,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags)
VOLUME_INFORMATION *vinf;
ntfschar *vname;
int i, j, eo;
unsigned int k;
u32 u;
vol = ntfs_volume_startup(dev, flags);
@ -1025,6 +1026,17 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags)
ntfs_log_perror("Failed to close $UpCase");
goto error_exit;
}
/* Consistency check of $UpCase, restricted to plain ASCII chars */
k = 0x20;
while ((k < vol->upcase_len)
&& (k < 0x7f)
&& (le16_to_cpu(vol->upcase[k])
== ((k < 'a') || (k > 'z') ? k : k + 'A' - 'a')))
k++;
if (k < 0x7f) {
ntfs_log_perror("Corrupted file $UpCase");
goto error_exit;
}
/*
* Now load $Volume and set the version information and flags in the