Thread (3 messages) 3 messages, 2 authors, 2012-08-24

[B.A.T.M.A.N.] [PATCH] batctl: Clear screen using ANSI escape codes

From: Sven Eckelmann <sven@narfation.org>
Date: 2012-08-19 21:53:02
Subsystem: the rest · Maintainer: Linus Torvalds

It is not necessary to call an external binary to clear the screen of a default
unix terminal emulator. The external call using system("clear") may be used by
an attacker to get untrusted code called with an higher privilege because
batctl has to be run as using uid 0.

Reported-by: Antonio Quartulli <redacted>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 functions.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/functions.c b/functions.c
index c78e408..1d737fa 100644
--- a/functions.c
+++ b/functions.c
@@ -184,7 +184,7 @@ open:
 	}
 
 	if (read_opt & CLR_CONT_READ)
-		system("clear");
+		printf("\033[2J\033[0;0f");
 
 read:
 	while (getline(&line_ptr, &len, fp) != -1) {
-- 
1.7.10.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help