| 4034 | } |
| 4035 | |
| 4036 | static 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 |
no test coverage detected