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:
parent
cecd633ca7
commit
61ed3ae6c8
1 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue