mirror of
https://github.com/Z3Prover/z3
synced 2026-05-17 07:29:28 +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:
parent
906ac55c6a
commit
cecd633ca7
1 changed files with 4 additions and 0 deletions
|
|
@ -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 == '_'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue