| 421 | } |
| 422 | |
| 423 | static int reject_outside(const struct object_id *oid UNUSED, |
| 424 | struct strbuf *base, const char *filename, |
| 425 | unsigned mode, void *context) |
| 426 | { |
| 427 | struct archiver_args *args = context; |
| 428 | struct strbuf buf = STRBUF_INIT; |
| 429 | struct strbuf path = STRBUF_INIT; |
| 430 | int ret = 0; |
| 431 | |
| 432 | if (S_ISDIR(mode)) |
| 433 | return READ_TREE_RECURSIVE; |
| 434 | |
| 435 | strbuf_addbuf(&path, base); |
| 436 | strbuf_addstr(&path, filename); |
| 437 | if (starts_with(relative_path(path.buf, args->prefix, &buf), "../")) |
| 438 | ret = -1; |
| 439 | strbuf_release(&buf); |
| 440 | strbuf_release(&path); |
| 441 | return ret; |
| 442 | } |
| 443 | |
| 444 | static int path_exists(struct archiver_args *args, const char *path) |
| 445 | { |
nothing calls this directly
no test coverage detected