diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-11-24 13:54:26 -0600 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-11-25 12:58:00 -0600 |
commit | 3bd0cd1ad574ead8fe5c5bc58d62089652a02606 (patch) | |
tree | 7f27cd7fa55a7aa92b8e657bf9aca652fd7b691b | |
parent | shell/main_edit.c: Note return value not checked (diff) | |
download | rtems-3bd0cd1ad574ead8fe5c5bc58d62089652a02606.tar.bz2 |
main_edit.c: Do not reference beyond end of array
-rw-r--r-- | cpukit/libmisc/shell/main_edit.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index 212b212987..2ede21bc36 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -815,6 +815,11 @@ static int getachar(void) #if KEY_HISTORY if (key_history_in < sizeof(key_history)) { key_history[key_history_in++] = ch; +#if defined(__rtems__) + } if (key_history_in > sizeof(key_history)) { + /* eliminate possibility of using index above array bounds */ + assert( key_history_in > sizeof(key_history)); +#endif } else { memmove(&key_history[0], &key_history[1], sizeof(key_history) - sizeof(key_history[0])); key_history[key_history_in - 1] = ch; |