Pull request

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl/zJMIACgkQnKSrs4Gr
 c8isHwgAm9SDFmIcj9qvb/YFvqrVHmCdw2vVSCfszh/MeGVhJ9ehdPC4LakNbs1O
 ReCaw8tXHoF6t9h2MUPB8dfUqV2bl5bXq/GqT/zukNPR8RJ4HIU+Du+hoRuQ5wJN
 b3EYd1KNJHBtCtrGbALqyc0v5rhdOvb4jsTQsnDqPsYoXIxrtaVTbofU/at5HTF3
 DvGX5qBCzDhlHIbkOcjms23t62N850TqvSENz2aCRS0Nv4bjQg0SiS2LP0r0TqIq
 MPedRa9D5m095ZfzyAie84HoXnqqIC65gVD/4U63CvEuzm8/I2h197ptnKo7+BSr
 teBgjoi55RGy/4kxZ3HTS6Oz5ftUQg==
 =jRdF
 -----END PGP SIGNATURE-----

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>
master
Peter Maydell 2021-01-04 15:02:53 +00:00
commit e551455f1e
1 changed files with 3 additions and 0 deletions

View File

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