diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2023-05-27 10:24:39 +0200 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2023-05-28 05:05:09 -0600 |
commit | 2e0e80db69bc705ab4c0e4aa04f6533379ba111b (patch) | |
tree | 4f30270829576c5ed8e58536f7bf50a256bddf5e /Userland/Libraries/LibC/grp.cpp | |
parent | 7987bf5b92317917e042cadfea1e8531c7f55df2 (diff) | |
download | serenity-2e0e80db69bc705ab4c0e4aa04f6533379ba111b.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibC/grp.cpp')
-rw-r--r-- | Userland/Libraries/LibC/grp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/grp.cpp b/Userland/Libraries/LibC/grp.cpp index 721a99c333..696a5ae554 100644 --- a/Userland/Libraries/LibC/grp.cpp +++ b/Userland/Libraries/LibC/grp.cpp @@ -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) { |