diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-09-22 15:30:47 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-22 15:30:47 -0700 |
| commit | 4b79ee4b0cd1130ba8907029cdc5f6a1632aca26 (patch) | |
| tree | fffdde0d87ff81da009801e7b32b30d27ca2ff08 | |
| parent | 1b3d6e17fe83eb6f79ffbac2f2c61bbf1eaef5f8 (diff) | |
| parent | 4eaed7c2f2aed1ef510ff97e7e91fa0cbcbef65d (diff) | |
| download | git-4b79ee4b0cd1130ba8907029cdc5f6a1632aca26.tar.gz | |
Merge branch 'jk/list-objects-filter-cleanup'
Fix uninitialized memory access in a recent fix-up that is already
in -rc1.
* jk/list-objects-filter-cleanup:
list-objects-filter: initialize sub-filter structs
| -rw-r--r-- | list-objects-filter-options.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index d46ce4acc4..5339660238 100644 --- a/list-objects-filter-options.c +++ b/list-objects-filter-options.c @@ -143,6 +143,7 @@ static int parse_combine_subfilter( ALLOC_GROW_BY(filter_options->sub, filter_options->sub_nr, 1, filter_options->sub_alloc); + list_objects_filter_init(&filter_options->sub[new_index]); decoded = url_percent_decode(subspec->buf); @@ -263,6 +264,8 @@ void parse_list_objects_filter( parse_error = gently_parse_list_objects_filter( filter_options, arg, &errbuf); } else { + struct list_objects_filter_options *sub; + /* * Make filter_options an LOFC_COMBINE spec so we can trivially * add subspecs to it. @@ -273,10 +276,11 @@ void parse_list_objects_filter( filter_spec_append_urlencode(filter_options, arg); ALLOC_GROW_BY(filter_options->sub, filter_options->sub_nr, 1, filter_options->sub_alloc); + sub = &filter_options->sub[filter_options->sub_nr - 1]; - parse_error = gently_parse_list_objects_filter( - &filter_options->sub[filter_options->sub_nr - 1], arg, - &errbuf); + list_objects_filter_init(sub); + parse_error = gently_parse_list_objects_filter(sub, arg, + &errbuf); } if (parse_error) die("%s", errbuf.buf); |
