From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jan Weitzel <j.weitzel@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] readkey: force return from while true
Date: Tue, 22 Nov 2011 21:20:02 +0100 [thread overview]
Message-ID: <20111122202002.GN27267@pengutronix.de> (raw)
In-Reply-To: <1321965139-17745-1-git-send-email-j.weitzel@phytec.de>
On Tue, Nov 22, 2011 at 01:32:19PM +0100, Jan Weitzel wrote:
> If read_key is feeded by STRG + KEY_LEFT you run into the while(1)
> loop and corrupt memory through esc array.
> Force return if index gets too high.
>
Wow, a shortcut to crash barebox. Applied to master.
Sascha
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
> ---
> lib/readkey.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lib/readkey.c b/lib/readkey.c
> index a42d1cb..895db82 100644
> --- a/lib/readkey.c
> +++ b/lib/readkey.c
> @@ -67,6 +67,8 @@ int read_key(void)
> esc[i] = getc();
> if (esc[i++] == '~')
> break;
> + if (i == 5)
> + return -1;
> }
> }
> esc[i] = 0;
> --
> 1.7.0.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-11-22 20:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 12:32 Jan Weitzel
2011-11-22 20:20 ` Sascha Hauer [this message]
2011-11-24 9:19 ` Marc Kleine-Budde
2011-11-24 10:48 ` [PATCH v2] " Jan Weitzel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111122202002.GN27267@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=j.weitzel@phytec.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox