mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
ukify: rstrip and escape binary null characters from 'inspect' output (#38607)
SBAT section of UKI may contain \u000 null characters. Rstrip them, and if there's anything left in the middle, escape them so they are displayed as text. Fixes #38606
This commit is contained in:
@@ -1695,7 +1695,7 @@ def inspect_section(
|
||||
|
||||
if ttype == 'text':
|
||||
try:
|
||||
struct['text'] = data.decode()
|
||||
struct['text'] = data.rstrip(b'\0').replace(b'\0', b'\\0').decode()
|
||||
except UnicodeDecodeError as e:
|
||||
print(f'Section {name!r} is not valid text: {e}', file=sys.stderr)
|
||||
struct['text'] = '(not valid UTF-8)'
|
||||
|
||||
Reference in New Issue
Block a user