| 12744 | } |
| 12745 | |
| 12746 | bool cbm_path_within_root(const char *root_path, const char *abs_path) { |
| 12747 | if (!root_path || !abs_path) { |
| 12748 | return false; |
| 12749 | } |
| 12750 | char real_root[CBM_SZ_4K]; |
| 12751 | char real_file[CBM_SZ_4K]; |
| 12752 | if (resolve_canonical_path(root_path, real_root, sizeof(real_root)) && |
| 12753 | resolve_canonical_path(abs_path, real_file, sizeof(real_file))) { |
| 12754 | if (canonical_path_has_root(real_root, real_file)) { |
| 12755 | return true; |
| 12756 | } |
| 12757 | } |
| 12758 | return false; |
| 12759 | } |
| 12760 | |
| 12761 | /* cbm_path_within_root with the root resolved once per request: search_code |
| 12762 | * checks every hit file and every rendered result against the same root, and |
no test coverage detected