From: Frank Stettner Date: Wed, 30 Jun 2021 12:46:31 +0000 (+0200) Subject: hp-3478a: Handle NULL dereference in read, write and list. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=dd143eb2c781c46bc3a7efd66d259e4b1390e1d2;p=libsigrok.git hp-3478a: Handle NULL dereference in read, write and list. --- diff --git a/src/hardware/hp-3478a/api.c b/src/hardware/hp-3478a/api.c index c1e494df..1979c529 100644 --- a/src/hardware/hp-3478a/api.c +++ b/src/hardware/hp-3478a/api.c @@ -192,6 +192,8 @@ static int config_get(uint32_t key, GVariant **data, (void)cg; + if (!sdi) + return SR_ERR_ARG; devc = sdi->priv; switch (key) { @@ -247,6 +249,8 @@ static int config_set(uint32_t key, GVariant *data, (void)cg; + if (!sdi) + return SR_ERR_ARG; devc = sdi->priv; switch (key) { @@ -294,6 +298,10 @@ static int config_list(uint32_t key, GVariant **data, GVariant *gvar, *arr[2]; GVariantBuilder gvb; + /* Only handle standard keys when no device instance is given. */ + if (!sdi) + return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); + devc = sdi->priv; switch (key) {