mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
fp-device: Return error if trying to list a storage-less device
Devices with no storage don't allow listing prints, and if we try to do that, we'd end up in trying to call a NULL function pointer, causing a crash So always check if the device has storage before calling the list vfunc, and if we fail, return an error. Include an unit-test to verify this situation
This commit is contained in:
committed by
Benjamin Berg
parent
15a90eb451
commit
355cae1bbd
@@ -1213,6 +1213,14 @@ fp_device_list_prints (FpDevice *device,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fp_device_has_storage (device))
|
||||
{
|
||||
g_task_return_error (task,
|
||||
fpi_device_error_new_msg (FP_DEVICE_ERROR_NOT_SUPPORTED,
|
||||
"Device has no storage"));
|
||||
return;
|
||||
}
|
||||
|
||||
priv->current_action = FPI_DEVICE_ACTION_LIST;
|
||||
priv->current_task = g_steal_pointer (&task);
|
||||
maybe_cancel_on_cancelled (device, cancellable);
|
||||
|
||||
Reference in New Issue
Block a user