summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2024-06-06 23:04:51 +0300
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-06-09 06:29:37 +0000
commit5793af2132e9f901cdc6a95da6fd7a5e4fb11087 (patch)
tree535b547abc95ecbadeff211599ebecdd1b3ae734
parent07efcfc28cc2ba1420a470f9bb9cf3be68d8ff47 (diff)
downloadvyos-1x-5793af2132e9f901cdc6a95da6fd7a5e4fb11087.tar.gz
vyos-1x-5793af2132e9f901cdc6a95da6fd7a5e4fb11087.zip
grub: T6453: Fixed GRUB variables parsing
To parse variables with `=` a variable name should be limited by alphanumerical characters only. (cherry picked from commit d3acecdf129cd940f8b2d1b229a6e2a343cab74b)
-rw-r--r--python/vyos/system/grub.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/python/vyos/system/grub.py b/python/vyos/system/grub.py
index 0d9c1340b..6f3bbdaf6 100644
--- a/python/vyos/system/grub.py
+++ b/python/vyos/system/grub.py
@@ -49,7 +49,7 @@ TMPL_GRUB_COMMON: str = 'grub/grub_common.j2'
BOOT_OPTS_STEM: str = 'boot=live rootdelay=5 noautologin net.ifnames=0 biosdevname=0 vyos-union=/boot/'
# prepare regexes
-REGEX_GRUB_VARS: str = r'^set (?P<variable_name>.+)=[\'"]?(?P<variable_value>.*)(?<![\'"])[\'"]?$'
+REGEX_GRUB_VARS: str = r'^set (?P<variable_name>\w+)=[\'"]?(?P<variable_value>.*)(?<![\'"])[\'"]?$'
REGEX_GRUB_MODULES: str = r'^insmod (?P<module_name>.+)$'
REGEX_KERNEL_CMDLINE: str = r'^BOOT_IMAGE=/(?P<boot_type>boot|live)/((?P<image_version>.+)/)?vmlinuz.*$'
REGEX_GRUB_BOOT_OPTS: str = r'^\s*set boot_opts="(?P<boot_opts>[^$]+)"$'