Changeset e37e8504 in rtems


Ignore:
Timestamp:
12/01/14 03:53:55 (9 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11, 5, master
Children:
dd309b1
Parents:
d006b46d
Message:

libmisc/shell: Edit history hack is corrupting memory. Remove it.

The hack was a debug aid and is not needed.

Close #2203.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/shell/main_edit.c

    rd006b46d re37e8504  
    219219  int untitled;             // Counter for untitled files
    220220};
    221 
    222 /*
    223  * This is a hack to allow a simple way to inspect the keys to
    224  * add extar decoding. It is not multi-user safe.
    225  */
    226 #define KEY_HISTORY 1
    227 #if KEY_HISTORY
    228 int key_history[32];
    229 size_t key_history_in;
    230 #endif
    231221
    232222//
     
    814804{
    815805  int ch = getchar();
    816 #if KEY_HISTORY
    817   if (key_history_in < sizeof(key_history)) {
    818       key_history[key_history_in++] = ch;
    819 #if defined(__rtems__)
    820   } if (key_history_in > sizeof(key_history)) {
    821     /* eliminate possibility of using index above array bounds */
    822    assert( key_history_in > sizeof(key_history));
    823 #endif
    824   } else {
    825     memmove(&key_history[0], &key_history[1], sizeof(key_history) - sizeof(key_history[0]));
    826     key_history[key_history_in - 1] = ch;
    827   }
    828 #endif
    829806  return ch;
    830807}
     
    21562133#if defined(__rtems__)
    21572134        /*
    2158          * Coverity spotted this as using ed after free() so changing 
     2135         * Coverity spotted this as using ed after free() so changing
    21592136         * the order of the statements.
    21602137         */
Note: See TracChangeset for help on using the changeset viewer.