From: Bert Vermeulen Date: Mon, 22 Apr 2013 11:33:31 +0000 (+0200) Subject: ols: Fix stack clobbering at start of acquisition X-Git-Tag: dsupstream~86 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2e5b73c00c7329c9b6ef7bf8f626a22884eac5c0;p=libsigrok.git ols: Fix stack clobbering at start of acquisition 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. --- diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index cab99896..a744fc5a 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -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;