From f2ba42e4c6e44db9274d051065a233d9ed622959 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 13 Jul 2009 16:59:18 +0000 Subject: 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 BUG: 134 (infinite loop in inode_path ()) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=134 --- libglusterfs/src/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 5b41cd7b5d3..858f7e14d93 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) && -- cgit