Skip to contentSkip to conversation

Block patches

GIT PULL Applied Stefan Hajnoczi 2 participants 3 messages Jan 4, 2021

lore
Share & tools
lore
#0 lore raw

The following changes since commit 41192db338588051f21501abc13743e62b0a5605:

Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request' into staging (2021-01-01 22:57:15 +0000)

are available in the Git repository at:

https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 593621f36b716eb091c4ec791db72dd4461789da:

readline: Fix possible array index out of bounds in readline_hist_add() (2021-01-04 11:13:39 +0000)

----------------------------------------------------------------
Pull request

----------------------------------------------------------------

Alex Chen (1):
readline: Fix possible array index out of bounds in
readline_hist_add()

 util/readline.c | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
2.29.2
#1 lore raw

[PULL 1/1] readline: Fix possible array index out of bounds in readline_hist_add()

From: Alex Chen <[email protected]>

When the 'cmdline' is the last entry in 'rs->history' array, there is no need to put this entry to the end of the array, partly because it is the last entry, and partly because the next operition will lead to array index out of bounds.

Message-id: [email protected]

---
 util/readline.c | 3 +++
 1 file changed, 3 insertions(+)
util/readline.c +3 -0
index e534460da6..f1ac6e4769 100644
@@ -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],
Signature · 1 line
2.29.2
#2 lore raw
In reply to Stefan Hajnoczi
Quoted 9 lines · Stefan Hajnoczi

The following changes since commit 41192db338588051f21501abc13743e62b0a5605:

Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request' into staging (2021-01-01 22:57:15 +0000)

are available in the Git repository at:

https://gitlab.com/stefanha/qemu.git tags/block-pull-request

Quoted 8 lines

for you to fetch changes up to 593621f36b716eb091c4ec791db72dd4461789da:

readline: Fix possible array index out of bounds in readline_hist_add() (2021-01-04 11:13:39 +0000)

----------------------------------------------------------------
Pull request

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.

-- PMM