From: Ben Pfaff Date: Mon, 25 Oct 2004 22:56:10 +0000 (+0000) Subject: Disallow the empty string as a file name. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a24478801bbb7d7f2fe791686b679acadefed5f;p=pintos-anon Disallow the empty string as a file name. --- diff --git a/src/filesys/directory.c b/src/filesys/directory.c index ec6ecd9..b08e7ee 100644 --- a/src/filesys/directory.c +++ b/src/filesys/directory.c @@ -140,7 +140,7 @@ dir_add (struct dir *d, const char *name, disk_sector_t inode_sector) ASSERT (name != NULL); ASSERT (lookup (d, name) == NULL); - if (strlen (name) > NAME_MAX) + if (*name == '\0' || strlen (name) > NAME_MAX) return false; for (i = 0; i < d->entry_cnt; i++)