| 8462 | } |
| 8463 | |
| 8464 | bool cbm_path_within_root(const char *root_path, const char *abs_path) { |
| 8465 | if (!root_path || !abs_path) { |
| 8466 | return false; |
| 8467 | } |
| 8468 | char real_root[CBM_SZ_4K]; |
| 8469 | char real_file[CBM_SZ_4K]; |
| 8470 | if (resolve_canonical_path(root_path, real_root, sizeof(real_root)) && |
| 8471 | resolve_canonical_path(abs_path, real_file, sizeof(real_file))) { |
| 8472 | if (canonical_path_has_root(real_root, real_file)) { |
| 8473 | return true; |
| 8474 | } |
| 8475 | } |
| 8476 | return false; |
| 8477 | } |
| 8478 | |
| 8479 | static char *resolve_snippet_source(const char *root_path, const char *file_path, int start, |
| 8480 | int end, char **out_abs_path) { |
no test coverage detected