projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs: Fix yaffs_readdir when dereferencing a symlink
[yaffs2.git]
/
direct
/
yaffsfs.c
diff --git
a/direct/yaffsfs.c
b/direct/yaffsfs.c
index 69cf0a48ad9e424d7fc53890683cc1af61682e87..cdde7abe4a549df817287d64390c87c083a78fc9 100644
(file)
--- a/
direct/yaffsfs.c
+++ b/
direct/yaffsfs.c
@@
-515,17
+515,17
@@
static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path,
thisMatchLength = 0;
matching = 1;
thisMatchLength = 0;
matching = 1;
+
if(!p)
continue;
if(!p)
continue;
- while (matching && *p && *leftOver) {
- /* Skip over any /s */
- while (yaffsfs_IsPathDivider(*p))
- p++;
+ /* Skip over any leading /s */
+ while (yaffsfs_IsPathDivider(*p))
+ p++;
+ while (yaffsfs_IsPathDivider(*leftOver))
+ leftOver++;
- /* Skip over any /s */
- while (yaffsfs_IsPathDivider(*leftOver))
- leftOver++;
+ while (matching && *p && *leftOver) {
/* Now match the text part */
while (matching &&
/* Now match the text part */
while (matching &&
@@
-539,6
+539,16
@@
static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path,
matching = 0;
}
}
matching = 0;
}
}
+
+ if ((*p && !yaffsfs_IsPathDivider(*p)) ||
+ (*leftOver && !yaffsfs_IsPathDivider(*leftOver)))
+ matching = 0;
+ else {
+ while (yaffsfs_IsPathDivider(*p))
+ p++;
+ while (yaffsfs_IsPathDivider(*leftOver))
+ leftOver++;
+ }
}
/* Skip over any /s in leftOver */
}
/* Skip over any /s in leftOver */
@@
-559,7
+569,6
@@
static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path,
retval = dev;
longestMatch = thisMatchLength;
}
retval = dev;
longestMatch = thisMatchLength;
}
-
}
return retval;
}
}
return retval;
}
@@
-3419,6
+3428,7
@@
static yaffs_DIR *yaffsfs_opendir_reldir_no_lock(struct yaffs_obj *reldir,
}
obj = yaffsfs_FindObject(reldir, dirname, 0, 1, NULL, ¬Dir, &loop);
}
obj = yaffsfs_FindObject(reldir, dirname, 0, 1, NULL, ¬Dir, &loop);
+ obj = yaffsfs_FollowLink(obj, 0, &loop);
if (!obj && notDir)
yaffsfs_SetError(-ENOTDIR);
if (!obj && notDir)
yaffsfs_SetError(-ENOTDIR);