diff options
author | Amar Tumballi <amar@gluster.com> | 2009-07-13 16:59:18 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-07-16 00:37:27 -0700 |
commit | f2ba42e4c6e44db9274d051065a233d9ed622959 (patch) | |
tree | 3b8f77e1f250f346ba14864fe7e209aa0abe9fec /libglusterfs/src/inode.c | |
parent | 106f0e848a6ae3a04ee9d1c1752badf60767d039 (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/src/inode.c')
-rw-r--r-- | libglusterfs/src/inode.c | 7 |
1 files changed, 7 insertions, 0 deletions
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) && |