hp-3478a: avoid NULL dereference in config API routines

The 'sdi' parameter to config API calls can be NULL. Only dereference
after checking its validity.

Reported-By: Alexandre Ferreira <alexandref75@hotmail.com>
This commit is contained in:
Gerhard Sittig 2021-06-28 07:34:23 +02:00
parent 1e91a90f2a
commit 020df861e0
1 changed files with 3 additions and 3 deletions

View File

@ -176,7 +176,7 @@ static int config_get(uint32_t key, GVariant **data,
(void)cg;
devc = sdi->priv;
devc = sdi ? sdi->priv : NULL;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
@ -231,7 +231,7 @@ static int config_set(uint32_t key, GVariant *data,
(void)cg;
devc = sdi->priv;
devc = sdi ? sdi->priv : NULL;
switch (key) {
case SR_CONF_LIMIT_SAMPLES:
@ -278,7 +278,7 @@ static int config_list(uint32_t key, GVariant **data,
GVariant *gvar, *arr[2];
GVariantBuilder gvb;
devc = sdi->priv;
devc = sdi ? sdi->priv : NULL;
switch (key) {
case SR_CONF_SCAN_OPTIONS: