2 * Copyright (C) 2012-2020 all contributors <cmogstored-public@yhbt.net>
3 * License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
5 #include "cmogstored.h"
8 * we could just use strstr(), but it's buggy on some glibc and
9 * we can expand this later (to tighten down to non-FIDs, for example)
12 machine path_traversal;
13 main := any* ("..") @ { found = true; fbreak; } any*;
18 static bool path_traversal_found(const char *buf, size_t len)
32 int mog_valid_path(const char *buf, size_t len)
34 if (len >= MOG_PATH_MAX)
37 return ! path_traversal_found(buf, len);