1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-12-23 22:05:30 +02:00
wernermisc/m1/patches/rtems/mem-fixes.patch

42 lines
1.5 KiB
Diff

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
Index: rtems/cpukit/libmisc/shell/main_mdump.c
===================================================================
--- rtems.orig/cpukit/libmisc/shell/main_mdump.c 2012-01-25 21:48:05.000000000 -0300
+++ rtems/cpukit/libmisc/shell/main_mdump.c 2012-01-25 21:48:27.000000000 -0300
@@ -47,8 +47,8 @@
}
if (argc > 2) {
- if ( rtems_string_to_int(argv[1], &max, NULL, 0) ) {
- printf( "Length argument (%s) is not a number\n", argv[1] );
+ if ( rtems_string_to_int(argv[2], &max, NULL, 0) ) {
+ printf( "Length argument (%s) is not a number\n", argv[2] );
return -1;
}
if (max <= 0) {
Index: rtems/cpukit/libmisc/shell/main_medit.c
===================================================================
--- rtems.orig/cpukit/libmisc/shell/main_medit.c 2012-01-25 21:48:30.000000000 -0300
+++ rtems/cpukit/libmisc/shell/main_medit.c 2012-01-25 21:50:30.000000000 -0300
@@ -55,7 +55,7 @@
* Now edit the memory
*/
n = 0;
- for (i=2 ; i<=argc ; i++) {
+ for (i=2 ; i<argc ; i++) {
unsigned char tmpc;
if ( rtems_string_to_unsigned_char(argv[i], &tmpc, NULL, 0) ) {