From: Timo Teräs Date: Fri, 14 Jul 2017 07:59:52 +0000 (+0200) Subject: add-remove-shell: fix crash when shell is already added X-Git-Tag: 1_28_0~410 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cc86b2ad965bff071185edbb77b5a6ea45023e43;p=oweals%2Fbusybox.git 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 Signed-off-by: Denys Vlasenko --- 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) while ((line = xmalloc_fgetline(orig_fp)) != NULL) { char **cpp = argv; while (*cpp) { - if (strcmp(*cpp, line) == 0) { + if (*cpp != dont_add && strcmp(*cpp, line) == 0) { /* Old file has this shell name */ if (REMOVE_SHELL) { /* we are remove-shell */