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>
This commit is contained in:
parent
a2bdc5c554
commit
cc86b2ad96
@ -84,7 +84,7 @@ int add_remove_shell_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
while ((line = xmalloc_fgetline(orig_fp)) != NULL) {
|
while ((line = xmalloc_fgetline(orig_fp)) != NULL) {
|
||||||
char **cpp = argv;
|
char **cpp = argv;
|
||||||
while (*cpp) {
|
while (*cpp) {
|
||||||
if (strcmp(*cpp, line) == 0) {
|
if (*cpp != dont_add && strcmp(*cpp, line) == 0) {
|
||||||
/* Old file has this shell name */
|
/* Old file has this shell name */
|
||||||
if (REMOVE_SHELL) {
|
if (REMOVE_SHELL) {
|
||||||
/* we are remove-shell */
|
/* we are remove-shell */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user