diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-20 00:46:32 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-08-20 00:46:32 +0000 |
commit | f31c3b677d588795b18f02a6b8de22057bfab4af (patch) | |
tree | 5aa9bb30f7b73673b2c44a07bd6bcfb333a3b280 /libbb/lineedit.c | |
parent | 4301616b27afa808eeb8ea619dd7f3f9fa540462 (diff) | |
download | busybox-w32-f31c3b677d588795b18f02a6b8de22057bfab4af.tar.gz busybox-w32-f31c3b677d588795b18f02a6b8de22057bfab4af.tar.bz2 busybox-w32-f31c3b677d588795b18f02a6b8de22057bfab4af.zip |
linedit: fix use-after-free
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 3e16f6423..a68e5a3c0 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1357,6 +1357,7 @@ static void win_changed(int nsig) | |||
1357 | */ | 1357 | */ |
1358 | int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st) | 1358 | int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st) |
1359 | { | 1359 | { |
1360 | int len; | ||
1360 | #if ENABLE_FEATURE_TAB_COMPLETION | 1361 | #if ENABLE_FEATURE_TAB_COMPLETION |
1361 | smallint lastWasTab = FALSE; | 1362 | smallint lastWasTab = FALSE; |
1362 | #endif | 1363 | #endif |
@@ -1376,7 +1377,6 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1376 | || !(initial_settings.c_lflag & ECHO) | 1377 | || !(initial_settings.c_lflag & ECHO) |
1377 | ) { | 1378 | ) { |
1378 | /* Happens when e.g. stty -echo was run before */ | 1379 | /* Happens when e.g. stty -echo was run before */ |
1379 | int len; | ||
1380 | parse_and_put_prompt(prompt); | 1380 | parse_and_put_prompt(prompt); |
1381 | fflush(stdout); | 1381 | fflush(stdout); |
1382 | if (fgets(command, maxsize, stdin) == NULL) | 1382 | if (fgets(command, maxsize, stdin) == NULL) |
@@ -1843,9 +1843,10 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1843 | signal(SIGWINCH, previous_SIGWINCH_handler); | 1843 | signal(SIGWINCH, previous_SIGWINCH_handler); |
1844 | fflush(stdout); | 1844 | fflush(stdout); |
1845 | 1845 | ||
1846 | len = command_len; | ||
1846 | DEINIT_S(); | 1847 | DEINIT_S(); |
1847 | 1848 | ||
1848 | return command_len; | 1849 | return len; /* can't return command_len, DEINIT_S() destroys it */ |
1849 | } | 1850 | } |
1850 | 1851 | ||
1851 | line_input_t* FAST_FUNC new_line_input_t(int flags) | 1852 | line_input_t* FAST_FUNC new_line_input_t(int flags) |