sim: host_readdir: Ensure NUL termination when truncating d_name
This commit is contained in:
parent
c65bdde5ac
commit
f89ccf873e
|
@ -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…
Reference in New Issue