From 5524b1730736c01d7b6172d2cc250b85cbf748d2 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sat, 30 Jul 2022 14:20:36 -0300 Subject: git: Properly sanitize, and format the patch file name in `parse_patch_list()` --- git.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'git.c') diff --git a/git.c b/git.c index 70be9a2..befdaa3 100644 --- a/git.c +++ b/git.c @@ -107,9 +107,14 @@ int parse_patch_list(void *ctx, void *ret, const keyword *key, keyword_val val) pr->patches[num_patches--] = NULL; /* For each patch file in the list. */ for (linked_list *patch = patch_list; patch != NULL; patch = patch->prev, --num_patches) { - const char *patch_file = (const char *)patch->data; + char *patch_file = create_num_str((const char *)patch->data, num_patches); + char *sanitized_patch_file = sanitize_str(patch_file); /* Create a new entry in the list. */ pr->patches[num_patches] = create_file(root, patch_file); + pr->patches[num_patches]->name = (char *)patch->data; + free(patch_file); + free(sanitized_patch_file); + } cleanup_linked_list(patch_list); -- cgit v1.2.3-13-gbd6f