Thread (3 messages) 3 messages, 2 authors, 2017-11-17

[PATCH] readline_simple: use len instead of CONFIG_CBSIZE

From: Gaël PORTAY <hidden>
Date: 2017-11-17 04:58:42
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

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

Signed-off-by: Gaël PORTAY <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help