Check if a slash-prefixed string looks like a filesystem path.
| 1344 | |
| 1345 | // Check if a slash-prefixed string looks like a filesystem path. |
| 1346 | static bool is_filesystem_path(const char *s, int len) { |
| 1347 | if (len <= MIN_SYS_PATH_LEN) { |
| 1348 | return false; |
| 1349 | } |
| 1350 | return strncmp(s, "/usr/", SLEN("/usr/")) == 0 || strncmp(s, "/bin/", SLEN("/bin/")) == 0 || |
| 1351 | strncmp(s, "/etc/", SLEN("/etc/")) == 0 || strncmp(s, "/var/", SLEN("/var/")) == 0 || |
| 1352 | strncmp(s, "/tmp/", SLEN("/tmp/")) == 0 || strncmp(s, "/opt/", SLEN("/opt/")) == 0 || |
| 1353 | strncmp(s, "/home/", SLEN("/home/")) == 0 || strncmp(s, "/dev/", SLEN("/dev/")) == 0 || |
| 1354 | strncmp(s, "/sys/", SLEN("/sys/")) == 0 || strncmp(s, "/proc/", SLEN("/proc/")) == 0; |
| 1355 | } |
| 1356 | |
| 1357 | // Check if a slash-prefixed string looks like a REST API path. |
| 1358 | static bool is_rest_path(const char *s, int len) { |