Skip to content

Commit

Permalink
Kernel: Unnamed regions still need a null-terminator in core dumps
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed May 30, 2021
1 parent 8c3e4cc commit 3e0266c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Kernel/CoreDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3e0266c

Please sign in to comment.