1 From 54fe53c365c35a3ab9aa4a0c12908079ef376f1e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?tpg=20=28Tomasz=20Pawe=C2=B3=20Gajc=29?= <tpgxyz@gmail.com>
3 Date: Tue, 1 Mar 2016 21:03:18 +0100
4 Subject: [PATCH] strip NUL bytes in stream before push in string - fixes bug
9 modules.d/50drm/module-setup.sh | 6 +++---
10 modules.d/90kernel-modules/module-setup.sh | 6 +++---
11 3 files changed, 7 insertions(+), 7 deletions(-)
13 diff --git a/dracut.sh b/dracut.sh
14 index 98dbe0b..2b583de 100755
17 @@ -1595,7 +1595,7 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
18 # strip kernel modules, but do not touch signed modules
19 find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
20 | while read -r -d $'\0' f || [ -n "$f" ]; do
21 - SIG=$(tail -c 28 "$f")
22 + SIG=$(tail -c 28 "$f" | tr -d '\000')
23 [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
24 done | xargs -r -0 strip -g
26 diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh
27 index 55a214e..80f8ecd 100755
28 --- a/modules.d/50drm/module-setup.sh
29 +++ b/modules.d/50drm/module-setup.sh
30 @@ -24,9 +24,9 @@ installkernel() {
32 while read _fname || [ -n "$_fname" ]; do
34 - *.ko) _fcont="$(< $_fname)" ;;
35 - *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
36 - *.ko.xz) _fcont="$(xz -dc $_fname)" ;;
37 + *.ko) _fcont="$(< "$_fname" | tr -d '\000')" ;;
38 + *.ko.gz) _fcont="$(gzip -dc "$_fname" | tr -d '\000')" ;;
39 + *.ko.xz) _fcont="$(xz -dc "$_fname" | tr -d '\000')" ;;
41 [[ $_fcont =~ $_drm_drivers
42 && ! $_fcont =~ iw_handler_get_spy ]] \
43 diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
44 index 300adc7..07b2912 100755
45 --- a/modules.d/90kernel-modules/module-setup.sh
46 +++ b/modules.d/90kernel-modules/module-setup.sh
47 @@ -10,9 +10,9 @@ installkernel() {
50 while read _f || [ -n "$_f" ]; do case "$_f" in
51 - *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;;
52 - *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
53 - *.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;;
54 + *.ko) [[ $(< "$_f" | tr -d '\000') =~ $_blockfuncs ]] && echo "$_f" ;;
55 + *.ko.gz) [[ $(gzip -dc <"$_f" | tr -d '\000') =~ $_blockfuncs ]] && echo "$_f" ;;
56 + *.ko.xz) [[ $(xz -dc <"$_f" | tr -d '\000') =~ $_blockfuncs ]] && echo "$_f" ;;