aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/busybox/0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch')
-rw-r--r--main/busybox/0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/busybox/0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch b/main/busybox/0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch
new file mode 100644
index 0000000000..e4b65c8147
--- /dev/null
+++ b/main/busybox/0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch
@@ -0,0 +1,33 @@
+From cc86b2ad965bff071185edbb77b5a6ea45023e43 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Fri, 14 Jul 2017 09:59:52 +0200
+Subject: [PATCH] add-remove-shell: fix crash when shell is already added
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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>
+---
+ loginutils/add-remove-shell.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+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 */
+--
+2.15.0
+