Kernel: Don't crash when writing a coredump with an unnamed region
Previously we'd try to call ByteBuffer::append(nullptr, 1) when we came across a VM region that had no name.
This commit is contained in:
parent
fd6b04055c
commit
9adcfd5726
Notes:
sideshowbarker
2024-07-18 17:16:16 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/9adcfd57261 Pull-request: https://github.com/SerenityOS/serenity/pull/7521
1 changed files with 3 additions and 1 deletions
|
@ -246,7 +246,9 @@ 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:
|
||||
memory_region_info_buffer.append(region->name().characters_without_null_termination(), region->name().length() + 1);
|
||||
auto name = region->name();
|
||||
if (!name.is_null())
|
||||
memory_region_info_buffer.append(name.characters_without_null_termination(), name.length() + 1);
|
||||
|
||||
regions_data += memory_region_info_buffer;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue