mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-03 20:27:58 +00:00
apps/nshlib: nsh_getdirpath(), use snprint instead of sprintf to avoid possibility of buffer overrun. Noted by Chung Hwan Kim.
This commit is contained in:
parent
909a4ec2ce
commit
9b951b4dd8
1 changed files with 2 additions and 2 deletions
|
|
@ -114,11 +114,11 @@ static char *nsh_getdirpath(FAR struct nsh_vtbl_s *vtbl,
|
|||
|
||||
if (strcmp(path, "/") == 0)
|
||||
{
|
||||
sprintf(vtbl->iobuffer, "/%s", file);
|
||||
snprintf(vtbl->iobuffer, IOBUFFERSIZE, "/%s", file);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(vtbl->iobuffer, "%s/%s", path, file);
|
||||
snprintf(vtbl->iobuffer, IOBUFFERSIZE, "%s/%s", path, file);
|
||||
}
|
||||
|
||||
vtbl->iobuffer[PATH_MAX] = '\0';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue