diff options
| author | Leitwolf | 2026-11-17 18:57:52 +0300 |
|---|---|---|
| committer | GitHub | 2026-11-17 18:57:52 +0300 |
| commit | 7ff85d401d6f7f2d37fc0566f346a521a9bb7cee (patch) | |
| tree | 334a71b7a7d5b209f778cc51696ef307be3c06e2 /src/Progmasoft/Runner/Process.cpp | |
| parent | eea3be11a9e1a047442d71626557e57c3061da1a (diff) | |
| parent | 98aa45f74647ab0e18d0a26615fb848f5f798745 (diff) | |
| download | catch3-7ff85d401d6f7f2d37fc0566f346a521a9bb7cee.tar.gz | |
Bound three string and XML reads that analysis flagged
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 a96b54e5..52c285e0 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; } |