Skip to content

Commit

Permalink
mkksiso: Fix grub2 editing error
Browse files Browse the repository at this point in the history
Fix a dangerous bug in editing grub2 config files. A typo that left a
leading / in the path will lead to os.path.join not joining with the
tmpdir and editing the "/boot/grub2/grub.cfg" file on the host which
could lead to failure to boot when the system restarts, depending on
what was being added to the cmdline.
  • Loading branch information
bcl committed Jun 1, 2022
1 parent 511ab12 commit 06244d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/mkksiso
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def EditGrub2(new_args, new_volid, old_volid, tmpdir):
Add the new arguments and change existing volid if requested
"""
grub_cfgs = ["EFI/BOOT/grub.cfg", "EFI/BOOT/BOOT.conf",
"/boot/grub2/grub.cfg", "boot/grub/grub.cfg"]
"boot/grub2/grub.cfg", "boot/grub/grub.cfg"]

if not any(os.path.exists(os.path.join(tmpdir, c)) for c in grub_cfgs):
log.warning("No grub config files found")
Expand Down

0 comments on commit 06244d3

Please sign in to comment.