diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-06 20:55:56 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-06 20:55:56 +0200 |
commit | 184c738582eb190489dd2e9d120b1e036df65401 (patch) | |
tree | c12ad562b1ecff416ed4bc48e0ccb4c1a0fc35c1 | |
parent | 035e71578e98744acba2394bb03686d08f60d956 (diff) | |
download | busybox-w32-184c738582eb190489dd2e9d120b1e036df65401.tar.gz busybox-w32-184c738582eb190489dd2e9d120b1e036df65401.tar.bz2 busybox-w32-184c738582eb190489dd2e9d120b1e036df65401.zip |
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>
-rw-r--r-- | NOFORK_NOEXEC.lst | 2 | ||||
-rw-r--r-- | coreutils/stty.c | 10 | ||||
-rw-r--r-- | debianutils/start_stop_daemon.c | 9 |
3 files changed, 12 insertions, 9 deletions
diff --git a/NOFORK_NOEXEC.lst b/NOFORK_NOEXEC.lst index 02e2ba956..fb76fcf63 100644 --- a/NOFORK_NOEXEC.lst +++ b/NOFORK_NOEXEC.lst | |||
@@ -327,7 +327,7 @@ softlimit - noexec. spawner | |||
327 | sort - noexec. runner | 327 | sort - noexec. runner |
328 | split - runner | 328 | split - runner |
329 | ssl_client - longterm | 329 | ssl_client - longterm |
330 | start-stop-daemon | 330 | start-stop-daemon - not noexec: uses bb_common_bufsiz1 |
331 | stat - nofork candidate(needs fewer allocs) | 331 | stat - nofork candidate(needs fewer allocs) |
332 | strings - runner | 332 | strings - runner |
333 | stty - noexec. nofork candidate: has no allocs or opens except xmove_fd(xopen("-F DEVICE"),STDIN). tcsetattr(STDIN) is not a problem: it would work the same across processes sharing this fd | 333 | stty - noexec. nofork candidate: has no allocs or opens except xmove_fd(xopen("-F DEVICE"),STDIN). tcsetattr(STDIN) is not a problem: it would work the same across processes sharing this fd |
diff --git a/coreutils/stty.c b/coreutils/stty.c index d09f0e453..2292fa5ee 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -782,12 +782,12 @@ struct globals { | |||
782 | unsigned max_col; | 782 | unsigned max_col; |
783 | /* Current position, to know when to wrap */ | 783 | /* Current position, to know when to wrap */ |
784 | unsigned current_col; | 784 | unsigned current_col; |
785 | char buf[10]; | ||
786 | } FIX_ALIASING; | 785 | } FIX_ALIASING; |
787 | #define G (*(struct globals*)bb_common_bufsiz1) | 786 | #define G (*(struct globals*)bb_common_bufsiz1) |
788 | #define INIT_G() do { \ | 787 | #define INIT_G() do { \ |
789 | G.device_name = bb_msg_standard_input; \ | 788 | G.device_name = bb_msg_standard_input; \ |
790 | G.max_col = 80; \ | 789 | G.max_col = 80; \ |
790 | G.current_col = 0; /* we are noexec, must clear */ \ | ||
791 | } while (0) | 791 | } while (0) |
792 | 792 | ||
793 | static void set_speed_or_die(enum speed_setting type, const char *arg, | 793 | 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) | |||
1018 | 1018 | ||
1019 | for (i = 0; i != CIDX_min; ++i) { | 1019 | for (i = 0; i != CIDX_min; ++i) { |
1020 | char ch; | 1020 | char ch; |
1021 | char buf10[10]; | ||
1022 | |||
1021 | /* If swtch is the same as susp, don't print both */ | 1023 | /* If swtch is the same as susp, don't print both */ |
1022 | #if VSWTCH == VSUSP | 1024 | #if VSWTCH == VSUSP |
1023 | if (i == CIDX_swtch) | 1025 | if (i == CIDX_swtch) |
@@ -1033,10 +1035,10 @@ static void do_display(const struct termios *mode, int all) | |||
1033 | #endif | 1035 | #endif |
1034 | ch = mode->c_cc[control_info[i].offset]; | 1036 | ch = mode->c_cc[control_info[i].offset]; |
1035 | if (ch == _POSIX_VDISABLE) | 1037 | if (ch == _POSIX_VDISABLE) |
1036 | strcpy(G.buf, "<undef>"); | 1038 | strcpy(buf10, "<undef>"); |
1037 | else | 1039 | else |
1038 | visible(ch, G.buf, 0); | 1040 | visible(ch, buf10, 0); |
1039 | wrapf("%s = %s;", nth_string(control_name, i), G.buf); | 1041 | wrapf("%s = %s;", nth_string(control_name, i), buf10); |
1040 | } | 1042 | } |
1041 | #if VEOF == VMIN | 1043 | #if VEOF == VMIN |
1042 | if ((mode->c_lflag & ICANON) == 0) | 1044 | if ((mode->c_lflag & ICANON) == 0) |
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 07c104baa..9effdc80b 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -79,6 +79,7 @@ Misc options: | |||
79 | //config: -N|--nicelevel N | 79 | //config: -N|--nicelevel N |
80 | 80 | ||
81 | //applet:IF_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, BB_DIR_SBIN, BB_SUID_DROP, start_stop_daemon)) | 81 | //applet:IF_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, BB_DIR_SBIN, BB_SUID_DROP, start_stop_daemon)) |
82 | /* not NOEXEC: uses bb_common_bufsiz1 */ | ||
82 | 83 | ||
83 | //kbuild:lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o | 84 | //kbuild:lib-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o |
84 | 85 | ||
@@ -409,11 +410,11 @@ static const char start_stop_daemon_longopts[] ALIGN1 = | |||
409 | "quiet\0" No_argument "q" | 410 | "quiet\0" No_argument "q" |
410 | "test\0" No_argument "t" | 411 | "test\0" No_argument "t" |
411 | "make-pidfile\0" No_argument "m" | 412 | "make-pidfile\0" No_argument "m" |
412 | #if ENABLE_FEATURE_START_STOP_DAEMON_FANCY | 413 | # if ENABLE_FEATURE_START_STOP_DAEMON_FANCY |
413 | "oknodo\0" No_argument "o" | 414 | "oknodo\0" No_argument "o" |
414 | "verbose\0" No_argument "v" | 415 | "verbose\0" No_argument "v" |
415 | "nicelevel\0" Required_argument "N" | 416 | "nicelevel\0" Required_argument "N" |
416 | #endif | 417 | # endif |
417 | "startas\0" Required_argument "a" | 418 | "startas\0" Required_argument "a" |
418 | "name\0" Required_argument "n" | 419 | "name\0" Required_argument "n" |
419 | "signal\0" Required_argument "s" | 420 | "signal\0" Required_argument "s" |
@@ -421,9 +422,9 @@ static const char start_stop_daemon_longopts[] ALIGN1 = | |||
421 | "chuid\0" Required_argument "c" | 422 | "chuid\0" Required_argument "c" |
422 | "exec\0" Required_argument "x" | 423 | "exec\0" Required_argument "x" |
423 | "pidfile\0" Required_argument "p" | 424 | "pidfile\0" Required_argument "p" |
424 | #if ENABLE_FEATURE_START_STOP_DAEMON_FANCY | 425 | # if ENABLE_FEATURE_START_STOP_DAEMON_FANCY |
425 | "retry\0" Required_argument "R" | 426 | "retry\0" Required_argument "R" |
426 | #endif | 427 | # endif |
427 | ; | 428 | ; |
428 | #endif | 429 | #endif |
429 | 430 | ||