From c3727658cac142caaae3c97cb6870903edd8124d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 26 Aug 2005 20:17:08 +0000 Subject: [PATCH] * Fix filenames collation. * Minor comment cleanup. --- include/ntfs/collate.h | 4 ++-- libntfs/collate.c | 2 +- libntfs/index.c | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/ntfs/collate.h b/include/ntfs/collate.h index e51eaa56..ee92e43d 100644 --- a/include/ntfs/collate.h +++ b/include/ntfs/collate.h @@ -1,6 +1,6 @@ /* - * collate.h - Defines for NTFS kernel collation handling. Part of the - * Linux-NTFS project. + * collate.h - Defines for NTFS collation handling. Part of the Linux-NTFS + * project. * * Copyright (c) 2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy diff --git a/libntfs/collate.c b/libntfs/collate.c index 885fa6d3..15251b09 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -1,5 +1,5 @@ /* - * collate.c - NTFS kernel collation handling. Part of the Linux-NTFS project. + * collate.c - NTFS collation handling. Part of the Linux-NTFS project. * * Copyright (c) 2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy diff --git a/libntfs/index.c b/libntfs/index.c index 2fbe4ee2..06cf70c1 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -256,6 +256,12 @@ done: */ rc = ntfs_collate(vol, cr, key, key_len, &ie->key, le16_to_cpu(ie->key_length)); + if (rc == NTFS_COLLATION_ERROR) { + ntfs_error(, "Collation error. Probably filename " + "contain invalid characters."); + err = ERANGE; + goto err_out; + } /* * If @key collates before the key of the current entry, there * is definitely no such key in this index but we might need to @@ -384,6 +390,12 @@ ia_done: */ rc = ntfs_collate(vol, cr, key, key_len, &ie->key, le16_to_cpu(ie->key_length)); + if (rc == NTFS_COLLATION_ERROR) { + ntfs_error(, "Collation error. Probably filename " + "contain invalid characters."); + err = ERANGE; + goto err_out; + } /* * If @key collates before the key of the current entry, there * is definitely no such key in this index but we might need to