]> sigrok.org Git - libsigrok.git/commitdiff
ols: Fix stack clobbering at start of acquisition
authorBert Vermeulen <redacted>
Mon, 22 Apr 2013 11:33:31 +0000 (13:33 +0200)
committerBert Vermeulen <redacted>
Mon, 22 Apr 2013 11:33:31 +0000 (13:33 +0200)
This off-by-one was clobbering the stack since introduced in a803c0db4d58.
However it only set one bit, and that generally appears to have been set
already, so this rarely affected anything. But when it did, it affected
a pointer, causing a segfault.

hardware/openbench-logic-sniffer/api.c

index cab998966142c856dc7c7e39adba00de4dab68ab..a744fc5a86e7d9e3dd4f0b2a21d77b1487a76f05 100644 (file)
@@ -395,7 +395,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        readcount = MIN(devc->max_samples / num_channels, devc->limit_samples) / 4;
 
        memset(trigger_config, 0, 16);
-       trigger_config[devc->num_stages - 1] |= 0x08;
+       trigger_config[devc->num_stages] |= 0x08;
        if (devc->trigger_mask[0]) {
                delaycount = readcount * (1 - devc->capture_ratio / 100.0);
                devc->trigger_at = (readcount - delaycount) * 4 - devc->num_stages;