change strcpy to strlcpy

Change-Id: I8b9429a3c225a82842fce136bdb14b8b135066d3
Signed-off-by: lilei19 <lilei19@xiaomi.com>
This commit is contained in:
lilei19 2023-02-09 19:01:32 +08:00 • committed by Xiang Xiao
parent e86745b9a2
commit 41f60bd669
33 changed files with 238 additions and 180 deletions

View file

@ -566,9 +566,9 @@ static void cfgdatacmd_show_all_config_items(void)
printf(fmtstr, "Name", "Len");
sprintf(fmtstr, "%%-%ds%%-6d", CONFIG_MTD_CONFIG_NAME_LEN);
#else
strcpy(fmtstr, "%-6s%-6s%-6sData\n");
strlcpy(fmtstr, "%-6s%-6s%-6sData\n", sizeof(fmtstr));
printf(fmtstr, "ID", "Inst", "Len");
strcpy(fmtstr, "%-6d%-6d%-6d");
strlcpy(fmtstr, "%-6d%-6d%-6d", sizeof(fmtstr));
#endif
/* Get the first config item */
@ -620,7 +620,7 @@ static void cfgdatacmd_show_all_config_items(void)
#ifdef CONFIG_MTD_CONFIG_NAMED
sprintf(fmtstr2, "\n%ds", CONFIG_MTD_CONFIG_NAME_LEN + 6);
#else
strcpy(fmtstr2, "\n%18s");
strlcpy(fmtstr2, "\n%18s", sizeof(fmtstr2));
#endif
/* Loop though all bytes and display them */