MCPcopy Index your code
hub / github.com/git/git / check_unsafe_path

Function check_unsafe_path

apply.c:4036–4052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4034}
4035
4036static int check_unsafe_path(struct patch *patch)
4037{
4038 const char *old_name = NULL;
4039 const char *new_name = NULL;
4040 if (patch->is_delete)
4041 old_name = patch->old_name;
4042 else if (!patch->is_new && !patch->is_copy)
4043 old_name = patch->old_name;
4044 if (!patch->is_delete)
4045 new_name = patch->new_name;
4046
4047 if (old_name && !verify_path(old_name, patch->old_mode))
4048 return error(_("invalid path '%s'"), old_name);
4049 if (new_name && !verify_path(new_name, patch->new_mode))
4050 return error(_("invalid path '%s'"), new_name);
4051 return 0;
4052}
4053
4054/*
4055 * Check and apply the patch in-core; leave the result in patch->result

Callers 1

check_patchFunction · 0.85

Calls 2

verify_pathFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected