summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/imfs
diff options
context:
space:
mode:
authorJamie Iles <jamie@jamieiles.com>2015-03-16 17:23:36 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-16 19:17:35 +0100
commit674f8b1b050c7f6544424ea5c882878699dbc248 (patch)
tree7e0c37789c335ca45d6e238d878e68ddcf34e0ef /cpukit/libfs/src/imfs
parentshell: remove rtems ifdef, upstream is correct (diff)
downloadrtems-674f8b1b050c7f6544424ea5c882878699dbc248.tar.bz2
IMFS: don't strlen() an unterminated string in IMFS_dir_read().
a43a3466 (IMFS: Implement variable length node names) introduced a changed to IMFS_jnode_t from being a null terminated string to a separate unterminated string and length. IMFS_dir_read() was still performing a strlen() on this unterminated string though and when doing an 'ls' in the fileio example I saw that some filenames had garbage suffixes.
Diffstat (limited to 'cpukit/libfs/src/imfs')
-rw-r--r--cpukit/libfs/src/imfs/imfs_dir_default.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpukit/libfs/src/imfs/imfs_dir_default.c b/cpukit/libfs/src/imfs/imfs_dir_default.c
index 98f06dfce4..2f1207205a 100644
--- a/cpukit/libfs/src/imfs/imfs_dir_default.c
+++ b/cpukit/libfs/src/imfs/imfs_dir_default.c
@@ -73,7 +73,7 @@ static ssize_t IMFS_dir_read(
dir_ent->d_off = current_entry;
dir_ent->d_reclen = sizeof( *dir_ent );
dir_ent->d_ino = IMFS_node_to_ino( imfs_node );
- dir_ent->d_namlen = strlen( imfs_node->name );
+ dir_ent->d_namlen = imfs_node->namelen;
memcpy( dir_ent->d_name, imfs_node->name, dir_ent->d_namlen + 1 );
iop->offset += sizeof( *dir_ent );