diff --git a/runtime/src/main/cpp/KDebug.cpp b/runtime/src/main/cpp/KDebug.cpp index 6415abd902f..8418b1c9f50 100644 --- a/runtime/src/main/cpp/KDebug.cpp +++ b/runtime/src/main/cpp/KDebug.cpp @@ -52,7 +52,7 @@ RUNTIME_USED KInt Konan_DebugObjectToUtf8Array(KRef obj, char* buffer, KInt buff if (data == nullptr) return 0; KInt toCopy = data->count_ > bufferSize - 1 ? bufferSize - 1 : data->count_; ::memcpy(buffer, ByteArrayAddressOfElementAt(data, 0), toCopy); - buffer[toCopy + 1] = '\0'; + buffer[toCopy] = '\0'; return toCopy + 1; }