1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 23:05:07 +00:00

Kernel: Unnamed regions still need a null-terminator in core dumps

Fixes #7595.
This commit is contained in:
Andreas Kling 2021-05-30 19:59:03 +02:00
parent 8c3e4ccd72
commit 3e0266c9e9

View file

@ -247,8 +247,12 @@ ByteBuffer CoreDump::create_notes_regions_data() const
memory_region_info_buffer.append((void*)&info, sizeof(info));
// NOTE: The region name *is* null-terminated, so the following is ok:
auto name = region->name();
if (!name.is_null())
if (name.is_empty()) {
char null_terminator = '\0';
memory_region_info_buffer.append(&null_terminator, 1);
} else {
memory_region_info_buffer.append(name.characters_without_null_termination(), name.length() + 1);
}
regions_data += memory_region_info_buffer;
}