summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-07-13 16:59:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-16 00:37:27 -0700
commitf2ba42e4c6e44db9274d051065a233d9ed622959 (patch)
tree3b8f77e1f250f346ba14864fe7e209aa0abe9fec /libglusterfs
parent106f0e848a6ae3a04ee9d1c1752badf60767d039 (diff)
break inode_path if the length of the path crosses PATH_MAX
a given search for path can't exceed the length of PATH_MAX in any case. Hence, its best to make sure by adding a check inside the for loop of inode_path, so that it won't enter an infinite loop. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 134 (infinite loop in inode_path ()) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=134
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/inode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 5b41cd7b..858f7e14 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -833,6 +833,13 @@ inode_path (inode_t *inode,
trav = __dentry_search_arbit (trav->parent)) {
i ++; /* "/" */
i += strlen (trav->name);
+ if (i > PATH_MAX) {
+ gf_log ("inode", GF_LOG_CRITICAL,
+ "possible infinite loop detected, "
+ "forcing break. name=(%s)", name);
+ ret = -ENOENT;
+ goto unlock;
+ }
}
if ((inode->ino != 1) &&