From: Alexander Popov Date: Sun, 2 Jun 2024 16:59:36 +0000 (+0300) Subject: Check that the cmdline file is not empty X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=1998660c07af1aabdd717d249b1e9336201a9fda;p=kconfig-hardened-check.git Check that the cmdline file is not empty --- diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 67e0269..5893fab 100644 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -174,6 +174,9 @@ def parse_cmdline_file(mode: StrOrNone, parsed_options: Dict[str, str], fname: s with open(fname, 'r', encoding='utf-8') as f: line = f.readline() + if not line: + sys.exit(f'[!] ERROR: empty "{fname}"') + opts = line.split() line = f.readline()