Changes by: antona
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30146
Modified Files:
attrib.c unistr.c
Log Message:
Fix a very(!) longstanding bug in ntfs_attr_find() and co.
Also reapply fix to unistr.c name collation.
Index: attrib.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/attrib.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -p -r1.175 -r1.176
--- attrib.c 24 Sep 2005 13:06:59 -0000 1.175
+++ attrib.c 24 Sep 2005 20:28:23 -0000 1.176
@@ -1559,23 +1559,10 @@ static int ntfs_attr_find(const ATTR_TYP
const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx)
{
ATTR_RECORD *a;
- ntfs_volume *vol;
- ntfschar *upcase;
- u32 upcase_len;
+ ntfs_volume *vol = ctx->ntfs_ino->vol;
+ ntfschar *upcase = vol->upcase;
+ u32 upcase_len = vol->upcase_len;
- if (!ctx || !ctx->mrec || !ctx->attr) {
- errno = EINVAL;
- return -1;
- }
- if (ic == IGNORE_CASE) {
- vol = ctx->ntfs_ino->vol;
- upcase = vol->upcase;
- upcase_len = vol->upcase_len;
- } else {
- vol = NULL;
- upcase = NULL;
- upcase_len = 0;
- }
/*
* Iterate over attributes in mft record starting at @ctx->attr, or the
* attribute following that, if @ctx->is_first is TRUE.
@@ -2176,9 +2163,12 @@ int ntfs_attr_lookup(const ATTR_TYPES ty
const VCN lowest_vcn, const u8 *val, const u32 val_len,
ntfs_attr_search_ctx *ctx)
{
+ ntfs_volume *vol;
ntfs_inode *base_ni;
- if (!ctx || !ctx->mrec || !ctx->attr) {
+ if (!ctx || !ctx->mrec || !ctx->attr || (name && (!ctx->ntfs_ino ||
+ !(vol = ctx->ntfs_ino->vol) || !vol->upcase ||
+ !vol->upcase_len))) {
errno = EINVAL;
return -1;
}
Index: unistr.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/unistr.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -p -r1.26 -r1.27
--- unistr.c 24 Sep 2005 15:29:54 -0000 1.26
+++ unistr.c 24 Sep 2005 20:28:23 -0000 1.27
@@ -115,7 +115,7 @@ int ntfs_names_collate(const ntfschar *n
ntfschar c1, c2;
#ifdef DEBUG
- if (!name1 || !name2 || (ic && !upcase && upcase_len)) {
+ if (!name1 || !name2 || (ic && (!upcase || !upcase_len))) {
Dputs("ntfs_names_collate received NULL pointer!");
exit(1);
}
|