1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:17:35 +00:00

LibC: Ensure that struct group::gr_mem pointers are aligned

Otherwise, we get a UBSan crash in SystemServer before we could even
start running tests on AArch64.
This commit is contained in:
Daniel Bertalan 2023-05-27 10:24:39 +02:00 committed by Andrew Kaster
parent 7987bf5b92
commit 2e0e80db69

View file

@ -113,7 +113,7 @@ static bool parse_grpdb_entry(char* buffer, size_t buffer_size, struct group& gr
// Must have room at the end of the buffer for the new table.
// Remaining space is one byte past null terminator generated by original line.
size_t bytes_used = line_length + 1;
size_t bytes_used = round_up_to_power_of_two(line_length + 1, alignof(char*));
size_t ptrs_size = sizeof(char const*) * members_ptrs.size();
if (bytes_used + ptrs_size < buffer_size) {