mirror of https://github.com/tailix/libkernaux.git
Test total size alignment
This commit is contained in:
parent
a6f8cbf6e7
commit
e2c60d3819
|
@ -19,6 +19,8 @@ extern "C" {
|
|||
|
||||
#define KERNAUX_MULTIBOOT2_DATA(ptr) (((uint8_t*)(ptr)) + sizeof(*(ptr)))
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_TAG_ALIGN 8
|
||||
|
||||
#define KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base) \
|
||||
((struct KernAux_Multiboot2_HTagBase*)KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base))
|
||||
#define KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base) \
|
||||
|
|
|
@ -26,6 +26,10 @@ bool KernAux_Multiboot2_Header_is_valid(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (multiboot2_header->total_size % KERNAUX_MULTIBOOT2_TAG_ALIGN != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (multiboot2_header->checksum !=
|
||||
KERNAUX_MULTIBOOT2_CHECKSUM(
|
||||
multiboot2_header->arch,
|
||||
|
|
|
@ -18,6 +18,10 @@ bool KernAux_Multiboot2_Info_is_valid(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (multiboot2_info->total_size % KERNAUX_MULTIBOOT2_TAG_ALIGN != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const struct KernAux_Multiboot2_ITagBase *tag_base =
|
||||
(struct KernAux_Multiboot2_ITagBase*)
|
||||
KERNAUX_MULTIBOOT2_DATA(multiboot2_info);
|
||||
|
|
Loading…
Reference in New Issue