nuttx:Change fs strncpy to strlcpy to avoid losing'\0'

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
This commit is contained in:
zhouliang3
2021-12-29 20:17:34 +08:00
committed by Xiang Xiao
parent 76b2f7199d
commit 1f53a058fa
20 changed files with 60 additions and 55 deletions

View File

@@ -342,9 +342,9 @@ static int spiffs_readdir_callback(FAR struct spiffs_s *fs,
}
#endif
strncpy(entryp->d_name,
strlcpy(entryp->d_name,
(FAR char *)objhdr.name + SPIFFS_LEADING_SLASH_SIZE,
NAME_MAX);
sizeof(entryp->d_name));
entryp->d_type = objhdr.type;
return OK;
}