Ticket #2001: mem-fixes.patch

File mem-fixes.patch, 1.5 KB (added by Sebastien Bourdeauducq, on Jan 26, 2012 at 8:48:36 AM)

patch

  • cpukit/libmisc/shell/main_mdump.c

    This patch fixes the "mdump" and "medit" shell commands:
    
    - "mdump" got the length argument wrong and would only produce useful
      output if it was omitted.
    
    - "medit" overran the argument list, choking on the NULL pointer
      following the last argument.
    
    Note that "medit" still only does byte-sized accesses, which limits
    its usefulness on most systems.
    
    - Werner
    
    old new  
    4747  }
    4848
    4949  if (argc > 2) {
    50     if ( rtems_string_to_int(argv[1], &max, NULL, 0) ) {
    51       printf( "Length argument (%s) is not a number\n", argv[1] );
     50    if ( rtems_string_to_int(argv[2], &max, NULL, 0) ) {
     51      printf( "Length argument (%s) is not a number\n", argv[2] );
    5252      return -1;
    5353    }
    5454    if (max <= 0) {
  • cpukit/libmisc/shell/main_medit.c

    old new  
    5555   * Now edit the memory
    5656   */
    5757  n = 0;
    58   for (i=2 ; i<=argc ; i++) {
     58  for (i=2 ; i<argc ; i++) {
    5959    unsigned char tmpc;
    6060
    6161    if ( rtems_string_to_unsigned_char(argv[i], &tmpc, NULL, 0) ) {