ash: fix "read -s" + ^C. Closes 5504
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 6 Sep 2012 11:28:10 +0000 (13:28 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 6 Sep 2012 11:28:10 +0000 (13:28 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/shell_common.c

index b20c32b89a0325f7e10f10e9cd5cfaec3179a882..153bcc0579fd3fad33850b12a2caaa5080dc332f 100644 (file)
@@ -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);
index 780e27ebd4f05ea4b9015c45ffe8c4ca9935e5d6..0051f21d9eb08d878ff72d6c6dda984b265a12d2 100644 (file)
@@ -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) {