#4556 new defect

rtems_shell_main_mmove problem

Reported by: chenjin_zhong Owned by:
Priority: normal Milestone: 5.1
Component: shell Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Hi, I think mmove command in shell means that the memory can be overlapped when copy happens. but I find that when implementing this function, the memcpy is used in RTEMS4.13/RTEMS5.1.Should the memcpy be replaced with memmove ? The src code is listed as follows.
static int rtems_shell_main_mmove(

int argc,
char *argv[]

)
{

unsigned long tmp;
void *src;
void *dst;
size_t length;

if ( argc < 4 ) {

fprintf(stderr,"%s: too few arguments\n", argv[0]);
return -1;

}

/*

  • Convert arguments into numbers */

if ( rtems_string_to_pointer(argv[1], &dst, NULL) ) {

printf( "Destination argument (%s) is not a number\n", argv[1] );
return -1;

}

if ( rtems_string_to_pointer(argv[2], &src, NULL) ) {

printf( "Source argument (%s) is not a number\n", argv[2] );
return -1;

}

if ( rtems_string_to_unsigned_long(argv[3], &tmp, NULL, 0) ) {

printf( "Length argument (%s) is not a number\n", argv[3] );
return -1;

}
length = (size_t) tmp;

/*

  • Now copy the memory. */

memcpy(dst, src, length);

return 0;

}

Change History (0)

Note: See TracTickets for help on using tickets.