diff options
author | Peter Maydell | 2021-01-04 16:02:53 +0100 |
---|---|---|
committer | Peter Maydell | 2021-01-04 16:02:53 +0100 |
commit | e551455f1e7a3d7eee9e11e2903e4050bc5511ae (patch) | |
tree | 13d7ce0d638b9e9f578c3192dbde7cd9002ea87b | |
parent | Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-requ... (diff) | |
parent | readline: Fix possible array index out of bounds in readline_hist_add() (diff) | |
download | qemu-e551455f1e7a3d7eee9e11e2903e4050bc5511ae.tar.gz qemu-e551455f1e7a3d7eee9e11e2903e4050bc5511ae.tar.xz qemu-e551455f1e7a3d7eee9e11e2903e4050bc5511ae.zip |
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-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>
-rw-r--r-- | util/readline.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/util/readline.c b/util/readline.c index e534460da6..f1ac6e4769 100644 --- a/util/readline.c +++ b/util/readline.c @@ -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], |