Lines Matching refs:path
18 static int uvwasi__is_absolute_path(const char* path, uvwasi_size_t path_len) {
20 return path != NULL && path_len > 0 && path[0] == '/';
35 uvwasi_errno_t uvwasi__normalize_path(const char* path,
49 is_absolute = uvwasi__is_absolute_path(path, path_len);
52 for (cur = path; cur != NULL; cur = next + 1) {
66 /* Identify the path segment that preceded the current one. */
72 /* If the result is currently empty, or the last prior path is also '..'
73 then output '..'. Otherwise, remove the last path segment. */
89 is the entire path. */
112 /* Normalized the path to the empty string. Return either '/' or '.'. */
127 static int uvwasi__is_path_sandboxed(const char* path,
135 return path == strstr(path, fd_path) ? 1 : 0;
139 /* If the fd's path is '.', then any path does not begin with '..' is OK. */
140 if ((path_len == 2 && path[0] == '.' && path[1] == '.') ||
141 (path_len > 2 && path[0] == '.' && path[1] == '.' && path[2] == '/')) {
148 if (path != strstr(path, fd_path))
151 /* Fail if the remaining path starts with '..', '../', '/..', or '/../'. */
152 ptr = (char*) path + fd_path_len;
175 const char* path,
180 /* This function resolves an absolute path to the provided file descriptor.
181 If the file descriptor's path is relative, then this operation will fail
183 path to a relative prefix. If the file desciptor's path is also absolute,
184 then we just need to verify that the normalized path still starts with
185 the file descriptor's path. */
199 /* Normalize the input path first. */
200 err = uvwasi__normalize_path(path, path_len, abs_path, path_len);
226 const char* path,
231 /* This function resolves a relative path to the provided file descriptor.
232 The relative path is concatenated to the file descriptor's path, and then
245 /* The max combined size is the path length + the file descriptor's path
246 length + 2 for a terminating NULL and a possible path separator. */
259 r = snprintf(combined, combined_size, "%s/%s", fd->normalized_path, path);
265 /* Normalize the input path. */
275 /* Once the path is normalized, ensure that it is still sandboxed. */
300 const char* path,
305 /* Return the normalized path, but resolved to the host's real path. */
318 /* If the fake path is '.' just ignore it. */
325 /* The resolved path's length is calculated as: the length of the fd's real
326 path, + 1 for a path separator, and the length of the input path (with the
327 fake path stripped off). */
335 stripped_path = (char*) path + fake_path_len;
367 const char* path,
383 input = path;