OSDN Git Service

reparse.c: Fix big-endian bug when converting file name to lowercase.
authorErik Larsson <mechie@users.sourceforge.net>
Mon, 4 Jan 2016 09:19:05 +0000 (10:19 +0100)
committerErik Larsson <mechie@users.sourceforge.net>
Mon, 4 Jan 2016 09:19:05 +0000 (10:19 +0100)
When looking up the lowercase equivalent of a Unicode character in
ntfs_fix_file_name, no byte swapping was performed on the ntfschar used
as index into the 'locase' array. This would lead to very strange
results on big-endian systems.

libntfs-3g/reparse.c

index 7b96902..ee14efb 100644 (file)
@@ -195,7 +195,7 @@ static u64 ntfs_fix_file_name(ntfs_inode *dir_ni, ntfschar *uname,
                                                uname[i] = found->file_name[i];
                                } else {
                                        for (i=0; i<found->file_name_length; i++)
-                                               uname[i] = vol->locase[found->file_name[i]];
+                                               uname[i] = vol->locase[le16_to_cpu(found->file_name[i])];
                                }
                        }
                }