Check that the cmdline file is not empty
authorAlexander Popov <alex.popov@linux.com>
Sun, 2 Jun 2024 16:59:36 +0000 (19:59 +0300)
committerAlexander Popov <alex.popov@linux.com>
Sun, 2 Jun 2024 16:59:36 +0000 (19:59 +0300)
kernel_hardening_checker/__init__.py

index 67e02690bee12aa8b6934f5ec3c7ee91cab044c0..5893fab542ddd3e16e1b22a55f86e5e21e1ab258 100644 (file)
@@ -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()