All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/1] Block patches
@ 2021-01-04 14:23 Stefan Hajnoczi
  2021-01-04 14:23 ` [PULL 1/1] readline: Fix possible array index out of bounds in readline_hist_add() Stefan Hajnoczi
  2021-01-04 17:17 ` [PULL 0/1] Block patches Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2021-01-04 14:23 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Stefan Hajnoczi, qemu-block

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(+)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL 1/1] readline: Fix possible array index out of bounds in readline_hist_add()
  2021-01-04 14:23 [PULL 0/1] Block patches Stefan Hajnoczi
@ 2021-01-04 14:23 ` Stefan Hajnoczi
  2021-01-04 17:17 ` [PULL 0/1] Block patches Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2021-01-04 14:23 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Alex Chen, Stefan Hajnoczi, qemu-block, Euler Robot

From: Alex Chen <alex.chen@huawei.com>

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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Message-id: 20201203135043.117072-1-alex.chen@huawei.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 util/readline.c | 3 +++
 1 file changed, 3 insertions(+)

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],
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL 0/1] Block patches
  2021-01-04 14:23 [PULL 0/1] Block patches Stefan Hajnoczi
  2021-01-04 14:23 ` [PULL 1/1] readline: Fix possible array index out of bounds in readline_hist_add() Stefan Hajnoczi
@ 2021-01-04 17:17 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2021-01-04 17:17 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers, Qemu-block

On Mon, 4 Jan 2021 at 14:23, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> 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
>
> ----------------------------------------------------------------


Applied, thanks.

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

-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-04 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 14:23 [PULL 0/1] Block patches Stefan Hajnoczi
2021-01-04 14:23 ` [PULL 1/1] readline: Fix possible array index out of bounds in readline_hist_add() Stefan Hajnoczi
2021-01-04 17:17 ` [PULL 0/1] Block patches Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.