From 9adcfd57261a4627501e8502a446160e0b499e7d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 28 May 2021 16:13:47 +0200 Subject: [PATCH] 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. --- Kernel/CoreDump.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Kernel/CoreDump.cpp b/Kernel/CoreDump.cpp index 3652c88b193..fd2a2f64541 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; }