lib: posix: fix out-of-bound write
Ensure that write is in buffer limits Coverity-CID: 186491 Signed-off-by: Paras Jain <parasjain2000@gmail.com>
This commit is contained in:
parent
eb9df85f84
commit
bf1e0198a7
1 changed files with 1 additions and 1 deletions
|
@ -293,7 +293,7 @@ struct dirent *readdir(DIR *dirp)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = strlen(fdirent.name);
|
rc = strlen(fdirent.name);
|
||||||
rc = (rc <= PATH_MAX) ? rc : PATH_MAX;
|
rc = (rc < PATH_MAX) ? rc : (PATH_MAX - 1);
|
||||||
memcpy(pdirent.d_name, fdirent.name, rc);
|
memcpy(pdirent.d_name, fdirent.name, rc);
|
||||||
|
|
||||||
/* Make sure the name is NULL terminated */
|
/* Make sure the name is NULL terminated */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue