From e3b71cf0356692bda5f0b3a06aed9d49ad3314a4 Mon Sep 17 00:00:00 2001 From: bspeice Date: Wed, 1 Jan 2025 18:26:43 -0800 Subject: Allow explicit test root (#5980) --- source/core/slang-io.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/core') diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index 7bfde7bd7..3c0c9a11e 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -992,12 +992,12 @@ static SlangResult _calcExectuablePath(char* outPath, size_t* ioSize) { return SLANG_FAIL; } - if (size_t(resSize) >= bufferSize) + if (size_t(resSize + 1) >= bufferSize) { return SLANG_E_BUFFER_TOO_SMALL; } // Zero terminate - outPath[resSize - 1] = 0; + outPath[resSize] = 0; return SLANG_OK; #else String text = Slang::File::readAllText("/proc/self/maps"); -- cgit v1.2.3