[git commit] ash: fix "read -s" + ^C. Closes 5504

Denys Vlasenko vda.linux at googlemail.com
Thu Sep 6 11:28:10 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=9e71e3cea59c06d40234d8f3363c3f05112e8d5a
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c          |    5 +++++
 shell/shell_common.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index b20c32b..153bcc0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12803,6 +12803,10 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 		}
 	}
 
+	/* "read -s" needs to save/restore termios, can't allow ^C
+	 * to jump out of it.
+	 */
+	INT_OFF;
 	r = shell_builtin_read(setvar2,
 		argptr,
 		bltinlookup("IFS"), /* can be NULL */
@@ -12812,6 +12816,7 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
 		opt_t,
 		opt_u
 	);
+	INT_ON;
 
 	if ((uintptr_t)r > 1)
 		ash_msg_and_raise_error(r);
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 780e27e..0051f21 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -170,7 +170,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val),
 		int timeout;
 
 		if ((bufpos & 0xff) == 0)
-			buffer = xrealloc(buffer, bufpos + 0x100);
+			buffer = xrealloc(buffer, bufpos + 0x101);
 
 		timeout = -1;
 		if (end_ms) {


More information about the busybox-cvs mailing list