mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
efivars: properly NUL terminate EFI variables when reading
A follow-up for 35b9eb0a72
.
This commit is contained in:
parent
e40b4caa1f
commit
861f178905
@ -93,8 +93,8 @@ int efi_get_variable(
|
||||
assert(n <= st.st_size - 4);
|
||||
|
||||
/* Always NUL terminate (2 bytes, to protect UTF-16) */
|
||||
((char*) buf)[n - 4] = 0;
|
||||
((char*) buf)[n - 4 + 1] = 0;
|
||||
((char*) buf)[n] = 0;
|
||||
((char*) buf)[n + 1] = 0;
|
||||
} else
|
||||
/* Assume that the reported size is accurate */
|
||||
n = st.st_size - 4;
|
||||
|
Loading…
Reference in New Issue
Block a user