MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / check_path

Function check_path

modules/http2d/server.c:500–505  ·  view source on GitHub ↗

Minimum check for directory traversal. Returns nonzero if it is safe. */

Source from the content-addressed store, hash-verified

498/* Minimum check for directory traversal. Returns nonzero if it is
499 safe. */
500static int check_path(const char *path) {
501 /* We don't like '\' in url. */
502 return path[0] && path[0] == '/' && strchr(path, '\\') == NULL &&
503 strstr(path, "/../") == NULL && strstr(path, "/./") == NULL &&
504 !ends_with(path, "/..") && !ends_with(path, "/.");
505}
506
507
508static int h2_fdpack(str *data)

Callers 1

on_request_recvFunction · 0.85

Calls 1

ends_withFunction · 0.85

Tested by

no test coverage detected