forked from Imagelibrary/rtems
cpukit/libmisc/monitor: Fix src/dest overlap of strcpy in mon-editor.c
See also CID 1399727 Closes #4444
This commit is contained in:
committed by
Vijay Kumar Banerjee
parent
ea41722c92
commit
6a56fd9340
@@ -360,7 +360,17 @@ rtems_monitor_line_editor (
|
||||
{
|
||||
int bs;
|
||||
pos--;
|
||||
strcpy (buffer + pos, buffer + pos + 1);
|
||||
|
||||
/*
|
||||
* Memory operation used here instead of string
|
||||
* method due the src and dest of buffer overlapping.
|
||||
*/
|
||||
memmove(
|
||||
buffer + pos,
|
||||
buffer + pos + 1,
|
||||
RTEMS_COMMAND_BUFFER_SIZE - pos - 1
|
||||
);
|
||||
buffer[RTEMS_COMMAND_BUFFER_SIZE - 1] = '\0';
|
||||
fprintf(stdout,"\b%s \b", buffer + pos);
|
||||
for (bs = 0; bs < ((int) strlen (buffer) - pos); bs++)
|
||||
putchar ('\b');
|
||||
|
||||
Reference in New Issue
Block a user