Commit 653a44f9 authored by Natanael Copa's avatar Natanael Copa

main/busybox: backport fix for add-shell

ref #8209
parent d9637cbe
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
......@@ -3,7 +3,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=busybox
pkgver=1.27.2
pkgrel=6
pkgrel=7
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url=http://busybox.net
arch="all"
......@@ -19,6 +19,7 @@ subpackages="$pkgname-static $pkgname-suid $pkgname-extras"
options="suid !check"
triggers="busybox.trigger=/bin:/usr/bin:/sbin:/usr/sbin:/lib/modules/*"
source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2
0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch
0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
0001-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
......@@ -184,6 +185,7 @@ static() {
}
sha512sums="d99e86b652562ebe1a5d50e1ba3877a1d1612997c17cb8d8e4212da181211a9b741a881cb051f14cb3ee8aea40226cf2cde80a076baed265d3bc0a4e96a5031c busybox-1.27.2.tar.bz2
26be93ba073556e8eeffbd9427b5d55129a05952ce52cec4ee7e10fe22bb0ee10c2c43d71925bf56905bec1dcc74c97e9b3ef6d97dc7fe0d2878fed64d854f7c 0001-add-remove-shell-fix-crash-when-shell-is-already-add.patch
dc08288c8e9e29d36be7174d58f3bee2d0508465977fb40d39807aa0b03149f7814f8cfed113d0a7589ef49890beb1805ef00f0d37b563447fe875e3cff08d1c 0001-ash-add-support-for-command_not_found_handle-hook-fu.patch
7904e47350ebad3f5370b0bca1b344a808cf4f1ae238686309a502bd675df7969eb76859c77ef81f709b0861173c9ca0181c5d5b8c3978e6149564384bb0c157 0001-fsck-resolve-LABEL-.-UUID-.-spec-to-device.patch
1930775839354a63c30970f0d52d00cfd3a8f6b9f48d6de45ea7d2478d080bde7193c1c2cce026dc7337d9ecf0b65f5ff1dd4351c1eb195e6f0c0c5126f10511 0001-ash-exec-busybox.static.patch
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment