scpi-pps: fixed out-of-bounds array access...

when accessing devc->device->channels in config_list().
this array has to be accessed via the "hw_output_idx"

This fixes bug #1533.
This commit is contained in:
Florian Schmidt 2020-04-08 12:24:48 +02:00 committed by Uwe Hermann
parent f0aec55605
commit 8f3c77db26
1 changed files with 3 additions and 1 deletions

View File

@ -674,6 +674,7 @@ static int config_list(uint32_t key, GVariant **data,
{
struct dev_context *devc;
struct sr_channel *ch;
struct pps_channel *pch;
const struct channel_spec *ch_spec;
int i;
const char *s[16];
@ -721,9 +722,10 @@ static int config_list(uint32_t key, GVariant **data,
* specification for use in series or parallel mode.
*/
ch = cg->channels->data;
pch = ch->priv;
if (!devc || !devc->device)
return SR_ERR_ARG;
ch_spec = &(devc->device->channels[ch->index]);
ch_spec = &(devc->device->channels[pch->hw_output_idx]);
switch (key) {
case SR_CONF_DEVICE_OPTIONS: