From: Wolfram Sang Date: Thu, 11 May 2017 11:51:07 +0000 (+0200) Subject: output/csv: fix segfault when naming logic channels X-Git-Tag: libsigrok-0.5.0~69 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6a235225b3817d45c3d4d1b9ce2c4928c1472256;p=libsigrok.git output/csv: fix segfault when naming logic channels 'j' is the loop variable for channels, not 'i'. This fixes parts of bug #844. Reported-by: Maxim Sloyko Signed-off-by: Wolfram Sang --- diff --git a/src/output/csv.c b/src/output/csv.c index 402ab904..97102f45 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -382,7 +382,7 @@ static void process_logic(struct context *ctx, sample = logic->data + i; idx = ctx->channels[ch].ch->index; if (ctx->label_do && !ctx->label_names) - ctx->channels[i].label = "logic"; + ctx->channels[j].label = "logic"; ctx->logic_samples[i * ctx->num_logic_channels + ch] = sample[idx / 8] & (1 << (idx % 8)); } ch++;