summaryrefslogtreecommitdiff
path: root/Kernel/CoreDump.cpp
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-28 16:13:47 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-28 16:48:17 +0200
commit9adcfd57261a4627501e8502a446160e0b499e7d (patch)
tree16c93c587207647ee33e941c8356f14f4c88c43d /Kernel/CoreDump.cpp
parentfd6b04055c3ca7d7e0f9e94f9842d83ea213f2ea (diff)
downloadserenity-9adcfd57261a4627501e8502a446160e0b499e7d.zip
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.
Diffstat (limited to 'Kernel/CoreDump.cpp')
-rw-r--r--Kernel/CoreDump.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/CoreDump.cpp b/Kernel/CoreDump.cpp
index 3652c88b19..fd2a2f6454 100644
--- a/Kernel/CoreDump.cpp
+++ b/Kernel/CoreDump.cpp
@@ -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;
}