mirror of
https://github.com/apache/nuttx.git
synced 2026-10-08 23:05:20 +00:00
sim: host_readdir: Ensure NUL termination when truncating d_name
This commit is contained in:
parent
c65bdde5ac
commit
f89ccf873e
1 changed files with 2 additions and 1 deletions
|
|
@ -320,7 +320,8 @@ int host_readdir(void *dirp, struct nuttx_dirent_s *entry)
|
|||
|
||||
/* Copy the entry name */
|
||||
|
||||
strncpy(entry->d_name, ent->d_name, sizeof(entry->d_name));
|
||||
strncpy(entry->d_name, ent->d_name, sizeof(entry->d_name) - 1);
|
||||
entry->d_name[sizeof(entry->d_name) - 1] = 0;
|
||||
|
||||
/* Map the type */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue