lib: posix: fs: Fix access invalid memory
fs_dirent.name is MAX_FILE_NAME + 1 bytes long, not PATH_MAX. Just fixing it to avoid access invalid memory. Coverity CID: 186037 Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
8945426026
commit
9d5936c04f
1 changed files with 1 additions and 1 deletions
|
@ -249,7 +249,7 @@ struct dirent *readdir(DIR *dirp)
|
|||
}
|
||||
|
||||
rc = strlen(fdirent.name);
|
||||
rc = (rc < PATH_MAX) ? rc : (PATH_MAX - 1);
|
||||
rc = (rc < MAX_FILE_NAME) ? rc : (MAX_FILE_NAME - 1);
|
||||
(void)memcpy(pdirent.d_name, fdirent.name, rc);
|
||||
|
||||
/* Make sure the name is NULL terminated */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue