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

Tighten tptp filename checks and rename output buffer constant

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:03:04 +00:00 committed by GitHub
parent cecd633ca7
commit 61ed3ae6c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,11 +22,15 @@ struct tptp_case {
char const* expected_status;
};
constexpr unsigned tptp_buffer_size = 4096;
constexpr unsigned command_output_buffer_size = 4096;
static bool is_safe_file_name(char const* s) {
if (!s || !*s)
return false;
if (s[0] == '-' || s[0] == '.')
return false;
if (std::string(s).find('/') != std::string::npos || std::string(s).find('\\') != std::string::npos)
return false;
if (std::string(s).find("..") != std::string::npos)
return false;
while (*s) {
@ -52,7 +56,7 @@ static std::string run_tptp(char const* file) {
ENSURE(false);
}
std::string out;
char buffer[tptp_buffer_size];
char buffer[command_output_buffer_size];
while (fgets(buffer, sizeof(buffer), pipe))
out += buffer;
int code = Z3_PCLOSE(pipe);