3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-16 23:25:36 +00:00

Validate tptp test filenames against empty and traversal patterns

Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/dc1d46fc-4b6c-4f64-91a0-9fb57c73c166

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-11 07:01:11 +00:00 committed by GitHub
parent 906ac55c6a
commit cecd633ca7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,6 +25,10 @@ struct tptp_case {
constexpr unsigned tptp_buffer_size = 4096;
static bool is_safe_file_name(char const* s) {
if (!s || !*s)
return false;
if (std::string(s).find("..") != std::string::npos)
return false;
while (*s) {
unsigned char c = static_cast<unsigned char>(*s);
if (!(std::isalnum(c) || c == '.' || c == '-' || c == '_'))