From f45ea4244288a2397b72c272184c9113ee0c1f08 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 17 Jul 2009 14:12:24 +0000 Subject: break inode_path if the length of the path crosses PATH_MAX 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 b0c9abd980c..0ad7b3585b5 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -859,6 +859,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