diff options
| author | Timo Teräs <timo.teras@iki.fi> | 2017-07-14 09:59:52 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-14 09:59:52 +0200 |
| commit | cc86b2ad965bff071185edbb77b5a6ea45023e43 (patch) | |
| tree | 5c0d8effa582b85170875cd538eed63090290a59 | |
| parent | a2bdc5c55485b054088513083ca0c78ce11445a9 (diff) | |
| download | busybox-w32-cc86b2ad965bff071185edbb77b5a6ea45023e43.tar.gz busybox-w32-cc86b2ad965bff071185edbb77b5a6ea45023e43.tar.bz2 busybox-w32-cc86b2ad965bff071185edbb77b5a6ea45023e43.zip | |
add-remove-shell: fix crash when shell is already added
Avoid dereferencing 'don_add' in strcmp since it is invalid
pointer.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | loginutils/add-remove-shell.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/loginutils/add-remove-shell.c b/loginutils/add-remove-shell.c index 922b3333d..54b62c773 100644 --- a/loginutils/add-remove-shell.c +++ b/loginutils/add-remove-shell.c | |||
| @@ -84,7 +84,7 @@ int add_remove_shell_main(int argc UNUSED_PARAM, char **argv) | |||
| 84 | while ((line = xmalloc_fgetline(orig_fp)) != NULL) { | 84 | while ((line = xmalloc_fgetline(orig_fp)) != NULL) { |
| 85 | char **cpp = argv; | 85 | char **cpp = argv; |
| 86 | while (*cpp) { | 86 | while (*cpp) { |
| 87 | if (strcmp(*cpp, line) == 0) { | 87 | if (*cpp != dont_add && strcmp(*cpp, line) == 0) { |
| 88 | /* Old file has this shell name */ | 88 | /* Old file has this shell name */ |
| 89 | if (REMOVE_SHELL) { | 89 | if (REMOVE_SHELL) { |
| 90 | /* we are remove-shell */ | 90 | /* we are remove-shell */ |
