MT#61856 call_interfaces: streams print hardening

The loop is 1-based, but checks the outside
of bounds with `i <= 1`. If the length is 1 and
iterator is 1, this already fails.

Hence allow `i` to be 1, and also check it's not
beyound the media array length.

Change-Id: I9112fc88155fa53205c04ef35b00f6573b6816b3
mr26.1
Donat Zenichev 3 weeks ago
parent 31375ca349
commit 6611e15d12

@ -76,7 +76,7 @@ static str streams_print(medias_arr *s, int start, int end, const char *prefix,
g_string_append_printf(o, "%s ", prefix);
for (i = start; i <= end; i++) {
if (s->len <= i || (media = s->pdata[i - 1]) == NULL) {
if (i < 1 || i > s->len || (media = s->pdata[i - 1]) == NULL) {
ilog(LOG_WARNING, "Requested media index %i not found", i);
break;
}

Loading…
Cancel
Save