Chromium Code Reviews| Index: scripts/image_signing/ensure_secure_kernelparams.sh |
| diff --git a/scripts/image_signing/ensure_secure_kernelparams.sh b/scripts/image_signing/ensure_secure_kernelparams.sh |
| index 1d159d4c6c1d42ce85ebc7f01647e42a28155620..e1577495cad87430914c70b29e9c88bc3819dc37 100755 |
| --- a/scripts/image_signing/ensure_secure_kernelparams.sh |
| +++ b/scripts/image_signing/ensure_secure_kernelparams.sh |
| @@ -32,6 +32,10 @@ dmparams_mangle_sha1() { |
| echo "$1" | sed 's/sha1 [0-9a-fA-F]*/sha1 MAGIC_HASH/' |
| } |
| +escape_regexmetas() { |
|
gauravsh
2011/02/18 00:11:56
add comment saying this escapes non-alphanumeric c
|
| + echo "$1" | sed 's/\([^a-zA-Z0-9]\)/\\\1/g' |
| +} |
| + |
| usage() { |
| echo "Usage $PROG image [config]" |
| } |
| @@ -93,13 +97,15 @@ main() { |
| else |
| # Remove matched params as we go. If all goes well, kparams_nodm |
| # will be nothing left but whitespace by the end. |
| - kparams_nodm=${kparams_nodm/$param/} |
| + param=$(escape_regexmetas "$param") |
| + kparams_nodm=$(echo "$kparams_nodm" | sed "s/\b$param\b//") |
| fi |
| done |
| # Check-off each of the allowed-but-optional params that were present. |
| for param in ${optional_kparams[@]}; do : |
|
gauravsh
2011/02/18 00:11:56
remove unnecessary colon at the end
|
| - kparams_nodm=${kparams_nodm/$param/} |
| + param=$(escape_regexmetas "$param") |
| + kparams_nodm=$(echo "$kparams_nodm" | sed "s/\b$param\b//") |
| done |
| # This section enforces the default-deny for any unexpected params |