Check if a slash-prefixed string looks like a filesystem path.
| 2058 | |
| 2059 | // Check if a slash-prefixed string looks like a filesystem path. |
| 2060 | static bool is_filesystem_path(const char *s, int len) { |
| 2061 | if (len <= MIN_SYS_PATH_LEN) { |
| 2062 | return false; |
| 2063 | } |
| 2064 | return strncmp(s, "/usr/", SLEN("/usr/")) == 0 || strncmp(s, "/bin/", SLEN("/bin/")) == 0 || |
| 2065 | strncmp(s, "/etc/", SLEN("/etc/")) == 0 || strncmp(s, "/var/", SLEN("/var/")) == 0 || |
| 2066 | strncmp(s, "/tmp/", SLEN("/tmp/")) == 0 || strncmp(s, "/opt/", SLEN("/opt/")) == 0 || |
| 2067 | strncmp(s, "/home/", SLEN("/home/")) == 0 || strncmp(s, "/dev/", SLEN("/dev/")) == 0 || |
| 2068 | strncmp(s, "/sys/", SLEN("/sys/")) == 0 || strncmp(s, "/proc/", SLEN("/proc/")) == 0; |
| 2069 | } |
| 2070 | |
| 2071 | // Check if a slash-prefixed string looks like a REST API path. |
| 2072 | static bool is_rest_path(const char *s, int len) { |