From 5d24e1125f323079f99fa4c9e4058711c730dc21 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Fri, 27 Mar 2026 17:17:45 +0100 Subject: [PATCH] Re-add src == dst check in SafeStringCopyTruncate Accidentally dropped this while iterating on the exact implementation. --- include/dusk/string.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/dusk/string.hpp b/include/dusk/string.hpp index 598ae83730..7de1b1ad75 100644 --- a/include/dusk/string.hpp +++ b/include/dusk/string.hpp @@ -26,6 +26,10 @@ template void SafeStringCopyTruncate(char (&buffer)[BufSize], const char* src) { static_assert(BufSize > 0, "Target buffer cannot be size zero"); + if (buffer == src) { + CRASH("Cannot copy string to same buffer"); + } + strncpyProxy(buffer, src, BufSize); buffer[BufSize - 1] = 0; }