change strcpy to strlcpy

Signed-off-by: lilei19 <lilei19@xiaomi.com>
This commit is contained in:
lilei19
2023-02-08 11:29:09 +08:00
committed by GUIDINGLI
parent 68ff73c5fb
commit 38f64f559d
47 changed files with 155 additions and 123 deletions

View File

@@ -35,11 +35,12 @@
#undef strdup /* See mm/README.txt */
FAR char *strdup(FAR const char *s)
{
FAR char *news = (FAR char *)lib_malloc(strlen(s) + 1);
size_t size = strlen(s) + 1;
FAR char *news = (FAR char *)lib_malloc(size);
if (news)
{
strcpy(news, s);
strlcpy(news, s, size);
}
return news;