From ef275e25b81406721eece940064db263f8d3afba Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 22 Jan 2023 15:04:35 -0500 Subject: [PATCH] AK: Reduce String's allocated data by one byte This was copied from allocation_size_for_stringimpl, which had to ensure the string is null-terminated. String makes no such guarantee. --- AK/String.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/String.cpp b/AK/String.cpp index 6fe7f9af52..828e165eed 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -109,7 +109,7 @@ StringData::~StringData() constexpr size_t allocation_size_for_string_data(size_t length) { - return sizeof(StringData) + (sizeof(char) * length) + sizeof(char); + return sizeof(StringData) + (sizeof(char) * length); } ErrorOr> StringData::create_uninitialized(size_t byte_count, u8*& buffer)