From 8fb14ba9ff6f8710e4c8d77e5c3c8e46d71500d7 Mon Sep 17 00:00:00 2001 From: "Michael I. Bushnell" Date: Fri, 5 Aug 1994 19:54:21 +0000 Subject: Formerly dir.c.~25~ --- ufs/dir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ufs') diff --git a/ufs/dir.c b/ufs/dir.c index f4bb4c63..a3b0b7f6 100644 --- a/ufs/dir.c +++ b/ufs/dir.c @@ -104,6 +104,9 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type, type &= ~SPEC_DOTDOT; namelen = strlen (name); + + if (namelen > MAXNAMLEN) + return ENAMETOOLONG; if (!S_ISDIR (dp->dn_stat.st_mode)) return ENOTDIR; @@ -506,6 +509,8 @@ diskfs_direnter(struct node *dp, case EXTEND: /* Extend the file. */ + assert (needed <= DIRBLKSIZ); + while (dp->dn_stat.st_size + DIRBLKSIZ > dp->allocsize) if (err = diskfs_grow (dp, dp->dn_stat.st_size + DIRBLKSIZ, cred)) { @@ -864,7 +869,8 @@ diskfs_get_directs (struct node *dp, struct olddirect *userd; userd = (struct olddirect *)datap; userd->d_ino = entryp->d_ino; - userd->d_reclen = userd->d_namlen = DIRECT_NAMLEN (entryp); + userd->d_namlen = DIRECT_NAMLEN (entryp); + userd->d_reclen = DIRSIZ (userd->d_namlen); bcopy (entryp->d_name, userd->d_name, DIRECT_NAMLEN (entryp) + 1); #endif i++; -- cgit v1.2.3