From b1eee22db83cc6d9847c03ac07e5cf5da81c2071 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 4 May 2020 14:57:52 +0200 Subject: [PATCH] grubby-bls: always escape the delimiter character used in sed commands The forward slash character is used as the delimiter for sed substitutions so this is escaped before calling sed. But this was only done before removing parameters from the kernel command and not when adding it. Use it for all the cases when the parameters are replaced in the update_args() function. Signed-off-by: Javier Martinez Canillas --- grubby-bls | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grubby-bls b/grubby-bls index de75da6..68cea40 100755 --- a/grubby-bls +++ b/grubby-bls @@ -459,8 +459,8 @@ update_args() { local add_args=($1) && shift for arg in ${remove_args[*]}; do + arg="$(echo $arg | sed -e 's/\//\\\//g')" if [[ $arg = *"="* ]]; then - arg="$(echo $arg | sed -e 's/\//\\\//g')" args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")" else args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" @@ -469,6 +469,7 @@ update_args() { for arg in ${add_args[*]}; do arg="${arg%%=*}" + arg="$(echo $arg | sed -e 's/\//\\\//g')" args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" done