diff options
author | Denys Vlasenko | 2017-08-06 20:55:56 +0200 |
---|---|---|
committer | Denys Vlasenko | 2017-08-06 20:55:56 +0200 |
commit | 184c738582eb190489dd2e9d120b1e036df65401 (patch) | |
tree | c12ad562b1ecff416ed4bc48e0ccb4c1a0fc35c1 /coreutils/stty.c | |
parent | 035e71578e98744acba2394bb03686d08f60d956 (diff) | |
download | busybox-184c738582eb190489dd2e9d120b1e036df65401.zip busybox-184c738582eb190489dd2e9d120b1e036df65401.tar.gz |
stty: fix bb_common_bufsiz1 use in NOEXEC
function old new delta
stty_main 1211 1221 +10
do_display 379 370 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r-- | coreutils/stty.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c index d09f0e4..2292fa5 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -782,12 +782,12 @@ struct globals { unsigned max_col; /* Current position, to know when to wrap */ unsigned current_col; - char buf[10]; } FIX_ALIASING; #define G (*(struct globals*)bb_common_bufsiz1) #define INIT_G() do { \ G.device_name = bb_msg_standard_input; \ G.max_col = 80; \ + G.current_col = 0; /* we are noexec, must clear */ \ } while (0) static void set_speed_or_die(enum speed_setting type, const char *arg, @@ -1018,6 +1018,8 @@ static void do_display(const struct termios *mode, int all) for (i = 0; i != CIDX_min; ++i) { char ch; + char buf10[10]; + /* If swtch is the same as susp, don't print both */ #if VSWTCH == VSUSP if (i == CIDX_swtch) @@ -1033,10 +1035,10 @@ static void do_display(const struct termios *mode, int all) #endif ch = mode->c_cc[control_info[i].offset]; if (ch == _POSIX_VDISABLE) - strcpy(G.buf, "<undef>"); + strcpy(buf10, "<undef>"); else - visible(ch, G.buf, 0); - wrapf("%s = %s;", nth_string(control_name, i), G.buf); + visible(ch, buf10, 0); + wrapf("%s = %s;", nth_string(control_name, i), buf10); } #if VEOF == VMIN if ((mode->c_lflag & ICANON) == 0) |