diff --git a/cpukit/libfs/src/jffs2/src/dir-rtems.c b/cpukit/libfs/src/jffs2/src/dir-rtems.c index 91906bac94..5afcf6702a 100644 --- a/cpukit/libfs/src/jffs2/src/dir-rtems.c +++ b/cpukit/libfs/src/jffs2/src/dir-rtems.c @@ -80,6 +80,10 @@ int jffs2_create(struct _inode *dir_i, const char *d_name, size_t d_namelen, int qstr.name = d_name; qstr.len = d_namelen; + if (d_namelen > JFFS2_MAX_NAME_LEN) { + return -ENAMETOOLONG; + } + ri = jffs2_alloc_raw_inode(); if (!ri) return -ENOMEM; @@ -148,6 +152,10 @@ int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, const unsigned uint8_t type = (old_d_inode->i_mode & S_IFMT) >> 12; if (!type) type = DT_REG; + if (d_namelen > JFFS2_MAX_NAME_LEN) { + return -ENAMETOOLONG; + } + ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, (const char * )d_name, d_namelen, get_seconds()); @@ -183,7 +191,7 @@ int jffs2_mknod( /* FIXME: If you care. We'd need to use frags for the data if it grows much more than this */ - if (datalen > 254) + if (datalen > 254 || d_namelen > JFFS2_MAX_NAME_LEN) return -ENAMETOOLONG; ri = jffs2_alloc_raw_inode(); @@ -373,6 +381,10 @@ int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, const unsign } #endif + if (new_d_namelen > JFFS2_MAX_NAME_LEN) { + return -ENAMETOOLONG; + } + /* XXX: We probably ought to alloc enough space for both nodes at the same time. Writing the new link, then getting -ENOSPC, is quite bad :) diff --git a/spec/build/bsps/tst.yml b/spec/build/bsps/tst.yml index a62645bcdd..5dd6c51e4a 100644 --- a/spec/build/bsps/tst.yml +++ b/spec/build/bsps/tst.yml @@ -65,14 +65,6 @@ actions: - mdosfsfsrenamemaxlinks - mimfsfsrenamemaxlinks - mrfsfsrenamemaxlinks -- set-test-state: - reason: | - Fails because of #5073, JFFS2 seems to not have appart - limits on file name length - state: expected-fail - tests: - - jffs2fsrenamelongname - - jffs2nandfsrenamelongname build-type: option copyrights: - Copyright (C) 2020 embedded brains GmbH & Co. KG