mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-18 00:11:20 +08:00
change strcpy to strlcpy
Change-Id: I8b9429a3c225a82842fce136bdb14b8b135066d3 Signed-off-by: lilei19 <lilei19@xiaomi.com>
This commit is contained in:
@@ -288,6 +288,7 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, FAR const char *msg,
|
||||
FAR const uint8_t *buffer, ssize_t nbytes)
|
||||
{
|
||||
char line[128];
|
||||
size_t size;
|
||||
int ch;
|
||||
int i;
|
||||
int j;
|
||||
@@ -299,13 +300,14 @@ void nsh_dumpbuffer(FAR struct nsh_vtbl_s *vtbl, FAR const char *msg,
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
size = strlen(line);
|
||||
if (i + j < nbytes)
|
||||
{
|
||||
sprintf(&line[strlen(line)], "%02x ", buffer[i + j]);
|
||||
sprintf(&line[size], "%02x ", buffer[i + j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(&line[strlen(line)], " ");
|
||||
strlcpy(&line[size], " ", sizeof(line) - size);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user