mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-26 15:23:59 +08:00
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.
This commit is contained in:
committed by
Sebastian Huber
parent
a62220fefa
commit
674f8b1b05
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user