diff options
| author | Leitwolf11 | 2026-11-15 22:29:48 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-15 22:29:48 +0300 |
| commit | 79f624d693b4fc3167c239c3eca47c858799333f (patch) | |
| tree | d42816753aa7f421e92dceba4e4e2b264b1a4773 /src/Progmasoft/Runner/Process.cpp | |
| parent | 6750f61c28be2861280078328e164e88bc1dfe44 (diff) | |
| download | catch3-79f624d693b4fc3167c239c3eca47c858799333f.tar.gz | |
Bound three string and XML reads that analysis flagged
- On macOS, the path from _NSGetExecutablePath is cut at its first NUL
found inside the buffer, in place of strlen, which reads until a NUL
wherever it is.
- The table test measures its C strings with std::string_view.
- The Bazel reporter test reads the JUnit report and rejects a document
type before parsing it, so no entity, external or internal, is ever
expanded.
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'src/Progmasoft/Runner/Process.cpp')
| -rw-r--r-- | src/Progmasoft/Runner/Process.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Progmasoft/Runner/Process.cpp b/src/Progmasoft/Runner/Process.cpp index e3b0997b..b858d1e6 100644 --- a/src/Progmasoft/Runner/Process.cpp +++ b/src/Progmasoft/Runner/Process.cpp @@ -1286,7 +1286,12 @@ namespace Progmasoft::Catch3::Runner std::string buffer(size, '\0'); if (_NSGetExecutablePath(buffer.data(), &size) == 0) { - buffer.resize(std::strlen(buffer.c_str())); + // The path ends at its first NUL, never past the buffer. + const auto end = buffer.find('\0'); + if (end != std::string::npos) + { + buffer.resize(end); + } auto canonical = std::filesystem::weakly_canonical(buffer, error); return error ? std::filesystem::path{ buffer } : canonical; } |