Skip to content

Commit da7a5a5

Browse files
committed
initramfs: re-add magic check
1 parent 817cbea commit da7a5a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/source/drivers/initramfs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace initramfs
1414
{
1515
namespace ustar
1616
{
17-
// constexpr std::string_view magic { "ustar", 6 };
17+
constexpr std::string_view magic { "ustar", 6 };
1818
// constexpr std::string_view version { "00", 2 };
1919

2020
enum types : char
@@ -65,8 +65,8 @@ namespace initramfs
6565
lib::info("ustar: extracting initramfs");
6666

6767
auto current = reinterpret_cast<header *>(data.data());
68-
// while (magic == std::string_view { current->magic, 6 })
69-
while (current < reinterpret_cast<header *>(data.data() + data.size()))
68+
while (magic == std::string_view { current->magic, 6 } &&
69+
current < reinterpret_cast<header *>(data.data() + data.size()))
7070
{
7171
if (current->name[0] == '\0')
7272
break;

0 commit comments

Comments
 (0)