From: Chaskiel M Grundman Date: Tue, 11 Sep 2007 16:40:26 +0000 (+0000) Subject: STABLE14-namei-protect-against-extra-files-20070911 X-Git-Tag: openafs-stable-1_4_5-pre1~12 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=d60ad4ac07ffe3c63d5d150c7dfe353c2abf74f3;p=packages%2Fo%2Fopenafs.git 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) --- 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 */