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:
parent
1e91a90f2a
commit
020df861e0
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue