Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull…
Browse files Browse the repository at this point in the history
…-request' into staging

Pull request

# gpg: Signature made Mon 04 Jan 2021 14:22:58 GMT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha-gitlab/tags/block-pull-request:
  readline: Fix possible array index out of bounds in readline_hist_add()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jan 4, 2021
2 parents 41192db + 593621f commit e551455
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions util/readline.c
Expand Up @@ -240,6 +240,9 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline)
}
if (strcmp(hist_entry, cmdline) == 0) {
same_entry:
if (idx == READLINE_MAX_CMDS - 1) {
return;
}
new_entry = hist_entry;
/* Put this entry at the end of history */
memmove(&rs->history[idx], &rs->history[idx + 1],
Expand Down

0 comments on commit e551455

Please sign in to comment.