mirror of
https://github.com/systemd/systemd.git
synced 2025-02-15 09:57:39 +03:00
bootctl: safety check for regular file when reading EFI images
This commit is contained in:
parent
78d5d4ed77
commit
c4ba5b516d
@ -96,6 +96,10 @@ static int get_file_version(int fd, char **v) {
|
|||||||
if (fstat(fd, &st) < 0)
|
if (fstat(fd, &st) < 0)
|
||||||
return log_error_errno(errno, "Failed to stat EFI binary: %m");
|
return log_error_errno(errno, "Failed to stat EFI binary: %m");
|
||||||
|
|
||||||
|
r = stat_verify_regular(&st);
|
||||||
|
if (r < 0)
|
||||||
|
return log_error_errno(errno, "EFI binary is not a regular file: %m");
|
||||||
|
|
||||||
if (st.st_size < 27) {
|
if (st.st_size < 27) {
|
||||||
*v = NULL;
|
*v = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user