]> sigrok.org Git - libsigrok.git/commitdiff
ipdbg-la: Check if limit samples is valid (leq size of ringuffer)
authorDaniel Anselmi <redacted>
Tue, 4 Dec 2018 00:55:00 +0000 (01:55 +0100)
committerUwe Hermann <redacted>
Thu, 27 Dec 2018 10:26:02 +0000 (11:26 +0100)
src/hardware/ipdbg-la/api.c

index c24eb908507a9c449d60d8d126987743f2217260..f3de8e63f3e2384813c1674472a10ed7f0394aec 100644 (file)
@@ -207,7 +207,11 @@ static int config_set(uint32_t key, GVariant *data,
                devc->capture_ratio = g_variant_get_uint64(data);
                break;
        case SR_CONF_LIMIT_SAMPLES:
-               devc->limit_samples = g_variant_get_uint64(data);
+               {
+                       uint64_t limit_samples = g_variant_get_uint64(data);
+                       if (limit_samples <= devc->limit_samples_max)
+                               devc->limit_samples = limit_samples;
+               }
                break;
        default:
                return SR_ERR_NA;