[rtems commit] PR 2001/shell - medit command argument parsing correction

Joel Sherrill joel at rtems.org
Fri Feb 3 22:08:09 UTC 2012


Module:    rtems
Branch:    master
Commit:    fdcf6c11b1aca7bd7185edc7620981f3f49a78f1
Changeset: http://git.rtems.org/rtems/commit/?id=fdcf6c11b1aca7bd7185edc7620981f3f49a78f1

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Fri Feb  3 16:05:50 2012 -0600

PR 2001/shell - medit command argument parsing correction

"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.

Author: Werner Almesberger <werner at almesberger.net>
Signed-off-by: Sebastien Bourdeauducq <sebastien at milkymist.org>

---

 cpukit/libmisc/shell/main_medit.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/cpukit/libmisc/shell/main_medit.c b/cpukit/libmisc/shell/main_medit.c
index d37a1d9..beaed75 100644
--- a/cpukit/libmisc/shell/main_medit.c
+++ b/cpukit/libmisc/shell/main_medit.c
@@ -8,8 +8,6 @@
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
  *  http://www.rtems.com/license/LICENSE.
- *
- *  $Id$
  */
 
 #ifdef HAVE_CONFIG_H
@@ -53,7 +51,7 @@ static int rtems_shell_main_medit(
    * 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) ) {




More information about the vc mailing list