]> sigrok.org Git - libsigrok.git/commitdiff
csv: Fix a segfault due to a g_malloc() allocating too few bytes.
authorUwe Hermann <redacted>
Fri, 2 Sep 2016 18:06:07 +0000 (20:06 +0200)
committerUwe Hermann <redacted>
Sun, 4 Sep 2016 16:03:50 +0000 (18:03 +0200)
src/output/csv.c

index 6900200db1b0e63994895828d2e6fb2fb7f9d8ba..e14984ef785379591b32b16f150e1e9dc3533d55 100644 (file)
@@ -319,7 +319,7 @@ static void process_analog(struct context *ctx,
        num_channels = g_slist_length(meaning->channels);
        ctx->channels_seen += num_channels;
        sr_dbg("Processing packet of %u analog channels", num_channels);
-       fdata = g_malloc(analog->num_samples * num_channels);
+       fdata = g_malloc(analog->num_samples * num_channels * sizeof(float));
        if ((ret = sr_analog_to_float(analog, fdata)) != SR_OK)
                sr_warn("Problems converting data to floating point values.");