From ca8dc6429b60df635a6bc4c3f82a25188131a149 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Thu, 27 Feb 2025 18:13:51 +0000 Subject: [PATCH] fix(kernel): fix empty initialization of std::string (str = "") _size is 0 which fails the memcpy checks Signed-off-by: EnderIce2 --- Kernel/include_std/string | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/include_std/string b/Kernel/include_std/string index 84f9c550..2137f5dc 100644 --- a/Kernel/include_std/string +++ b/Kernel/include_std/string @@ -1013,7 +1013,7 @@ namespace std _size = Traits::length(s); _capacity = _size + 1; _data = _alloc.allocate(_capacity); - memcpy(_data, s, _size); + memcpy(_data, s, _size > 0 ? _size : 1); _data[_size] = '\0'; return *this; }