From 7fe7ef499e87fa903e05857b5c8b29bae2903a53 Mon Sep 17 00:00:00 2001 From: wangjun Date: Mon, 18 Dec 2023 09:24:49 +0000 Subject: [PATCH] initscripts: prevent the occurrence of unsupported array subscript retrieval in busybox bash --- ...-subscript-retrieval-in-busybox-bash.patch | 37 +++++++++++++++++++ initscripts.spec | 9 ++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 bugfix-prevent-subscript-retrieval-in-busybox-bash.patch diff --git a/bugfix-prevent-subscript-retrieval-in-busybox-bash.patch b/bugfix-prevent-subscript-retrieval-in-busybox-bash.patch new file mode 100644 index 0000000..67c530d --- /dev/null +++ b/bugfix-prevent-subscript-retrieval-in-busybox-bash.patch @@ -0,0 +1,37 @@ +From 084f6af51824cfe4d6cd876306e68f7cce84ac0e Mon Sep 17 00:00:00 2001 +From: xiechengliang +Date: Mon, 18 Dec 2023 09:09:11 +0000 +Subject: [PATCH] prevent the occurrence of unsupported array subscript + retrieval in bosybox bash + +--- + etc/rc.d/init.d/functions | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/etc/rc.d/init.d/functions b/etc/rc.d/init.d/functions +index 0d973b3..b4898be 100644 +--- a/etc/rc.d/init.d/functions ++++ b/etc/rc.d/init.d/functions +@@ -119,8 +119,7 @@ __kill_pids_term_kill_checkpids() { + [ ! -e "/proc/$pid" ] && continue + read -r line < "/proc/$pid/stat" 2> /dev/null + +- stat=($line) +- stime=${stat[21]} ++ stime=$(cat /proc/$pid/stat | cut -d" " -f22) + + [ -n "$stime" ] && [ "$base_stime" -lt "$stime" ] && continue + remaining="$remaining$pid " +@@ -141,8 +140,7 @@ __kill_pids_term_kill() { + + # We can't initialize stat & base_stime on the same line where 'local' + # keyword is, otherwise the sourcing of this file will fail for ksh... +- stat=($(< /proc/self/stat)) +- base_stime=${stat[21]} ++ base_stime=$(cat /proc/self/stat | cut -d" " -f22) + + if [ "$1" = "-d" ]; then + delay=$2 +-- +2.33.0 + diff --git a/initscripts.spec b/initscripts.spec index 93ef1bd..a797526 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -20,7 +20,7 @@ Requires: gawk \ Name: initscripts Summary: Basic support for legacy System V init scripts Version: 10.17 -Release: 2 +Release: 3 License: GPLv2 @@ -92,6 +92,7 @@ Patch9004: bugfix-restart-network-warning.patch Patch9005: new-network-fork-to-start-dhcp.patch Patch9006: exec-udevadm-settle-when-network-start.patch Patch9007: remove-rename_device_lock-when-process-does-not-exis.patch +Patch9008: bugfix-prevent-subscript-retrieval-in-busybox-bash.patch %description This package provides basic support for legacy System V init scripts, and some @@ -387,6 +388,12 @@ fi # ============================================================================= %changelog +* Mon Dec 18 2023 wangjun - 10.17-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:prevent the occurrence of unsupported array subscript retrieval in busybox bash + * Mon Feb 20 2023 gaihuiying - 10.17-2 - Type:bugfix - ID:NA -- Gitee