mirror of
https://github.com/systemd/systemd.git
synced 2026-08-12 22:17:19 +00:00
dissect-image: reject empty partitions array
di is allocated while iterating over p.partitions. If the array is
empty,
the loop is skipped and di remains NULL, but the code still assigns
image
metadata through it.
Return EBADMSG before accessing di in this case.
Found by Linux Verification Center (linuxtesting.org) with Svace.
(cherry picked from commit d096763827)
This commit is contained in:
committed by
Yu Watanabe
parent
52fbac7c56
commit
42b356b0e0
@@ -5398,6 +5398,9 @@ int mountfsd_mount_image_fd(
|
||||
};
|
||||
}
|
||||
|
||||
if (!di)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "Partition list is empty.");
|
||||
|
||||
di->single_file_system = p.single_file_system;
|
||||
di->image_size = p.image_size;
|
||||
di->sector_size = p.sector_size;
|
||||
|
||||
Reference in New Issue
Block a user