Skip to content

Commit 4b79ee4

Browse files
committed
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
2 parents 1b3d6e1 + 4eaed7c commit 4b79ee4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

list-objects-filter-options.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static int parse_combine_subfilter(
143143

144144
ALLOC_GROW_BY(filter_options->sub, filter_options->sub_nr, 1,
145145
filter_options->sub_alloc);
146+
list_objects_filter_init(&filter_options->sub[new_index]);
146147

147148
decoded = url_percent_decode(subspec->buf);
148149

@@ -263,6 +264,8 @@ void parse_list_objects_filter(
263264
parse_error = gently_parse_list_objects_filter(
264265
filter_options, arg, &errbuf);
265266
} else {
267+
struct list_objects_filter_options *sub;
268+
266269
/*
267270
* Make filter_options an LOFC_COMBINE spec so we can trivially
268271
* add subspecs to it.
@@ -273,10 +276,11 @@ void parse_list_objects_filter(
273276
filter_spec_append_urlencode(filter_options, arg);
274277
ALLOC_GROW_BY(filter_options->sub, filter_options->sub_nr, 1,
275278
filter_options->sub_alloc);
279+
sub = &filter_options->sub[filter_options->sub_nr - 1];
276280

277-
parse_error = gently_parse_list_objects_filter(
278-
&filter_options->sub[filter_options->sub_nr - 1], arg,
279-
&errbuf);
281+
list_objects_filter_init(sub);
282+
parse_error = gently_parse_list_objects_filter(sub, arg,
283+
&errbuf);
280284
}
281285
if (parse_error)
282286
die("%s", errbuf.buf);

0 commit comments

Comments
 (0)