]> Zhao Yanbai Git Server - minix.git/commitdiff
VFS: fix off-by-one in get_name()
authorDavid van Moolenbroek <david@minix3.org>
Fri, 30 Nov 2012 12:22:36 +0000 (12:22 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Fri, 30 Nov 2012 12:24:47 +0000 (12:24 +0000)
servers/vfs/path.c

index 4b5de554ddff3ea282520f721b1b99d71d6ee91e..ba1d810896f2bd83d6021ef02b524ab3945ba396 100644 (file)
@@ -620,7 +620,7 @@ char ename[NAME_MAX + 1];
                cur = (struct dirent *) (buf + consumed);
                name_len = cur->d_reclen - offsetof(struct dirent, d_name) - 1;
 
-               if(cur->d_name + name_len+1 >= &buf[DIR_ENTRIES*DIR_ENTRY_SIZE])
+               if(cur->d_name + name_len+1 > &buf[sizeof(buf)])
                        return(EINVAL); /* Rubbish in dir entry */
                if (entry->v_inode_nr == cur->d_ino) {
                        /* found the entry we were looking for */