mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Gaël PORTAY" <gael.portay@savoirfairelinux.com>
To: barebox@lists.infradead.org
Cc: "Gaël PORTAY" <gael.portay@savoirfairelinux.com>
Subject: [PATCH] readline_simple: use len instead of CONFIG_CBSIZE
Date: Thu, 16 Nov 2017 23:58:14 -0500	[thread overview]
Message-ID: <20171117045814.16164-1-gael.portay@savoirfairelinux.com> (raw)

It is safier to use the length given in parameter instead of using the
preprocessor CONFIG_CBSIZE value.

Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
---
 lib/readline_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/readline_simple.c b/lib/readline_simple.c
index 80e075bc5..fcdbca41a 100644
--- a/lib/readline_simple.c
+++ b/lib/readline_simple.c
@@ -100,7 +100,7 @@ int readline (const char *prompt, char *line, int len)
 			/*
 			 * Must be a normal character then
 			 */
-			if (n < CONFIG_CBSIZE-2) {
+			if (n < len-2) {
 				if (c == '\t') {	/* expand TABs		*/
 					puts (tab_seq+(col&07));
 					col += 8 - (col&07);
-- 
2.15.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2017-11-17  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17  4:58 Gaël PORTAY [this message]
2017-11-17  9:14 ` Sascha Hauer
2017-11-17 14:12   ` Gaël PORTAY

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=20171117045814.16164-1-gael.portay@savoirfairelinux.com \
    --to=gael.portay@savoirfairelinux.com \
    --cc=barebox@lists.infradead.org \
    /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