From d60ad4ac07ffe3c63d5d150c7dfe353c2abf74f3 Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Tue, 11 Sep 2007 16:40:26 +0000 Subject: [PATCH] STABLE14-namei-protect-against-extra-files-20070911 if someone is monkeying in the filesystem, sometimes they shoot themselves. save them if they renamed foo to foo.bak (where foo is a full 64 bits) (cherry picked from commit c22f945bb783ba003c12ce73574568a9c4b80304) --- src/vol/namei_ops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index c818603b5..240e4be27 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1447,6 +1447,7 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid) char fpath[512]; struct afs_stat status; int parm, tag; + lb64_string_t check; (void)strcpy(fpath, dpath); (void)strcat(fpath, "/"); @@ -1459,6 +1460,10 @@ DecodeInode(char *dpath, char *name, struct ViceInodeInfo *info, int volid) info->byteCount = status.st_size; info->inodeNumber = (Inode) flipbase64_to_int64(name); + int64_to_flipbase64(check, info->inodeNumber); + if (strcmp(name, check)) + return -1; + GetOGMFromStat(&status, &parm, &tag); if ((info->inodeNumber & NAMEI_INODESPECIAL) == NAMEI_INODESPECIAL) { /* p1 - vid, p2 - -1, p3 - type, p4 - rwvid */ -- 2.39.5