mirror of
https://git.proxmox.com/git/fwupd
synced 2025-06-01 11:10:46 +00:00
trivial: Fix a potential OOB write that can't actually happen
This commit is contained in:
parent
500dd2c9c4
commit
2883b577dc
@ -481,6 +481,7 @@ fu_device_get_request_cnt(FuDevice *self, FwupdRequestKind request_kind)
|
||||
{
|
||||
FuDevicePrivate *priv = GET_PRIVATE(self);
|
||||
g_return_val_if_fail(FU_IS_DEVICE(self), G_MAXUINT);
|
||||
g_return_val_if_fail(request_kind < FWUPD_REQUEST_KIND_LAST, G_MAXUINT);
|
||||
return priv->request_cnts[request_kind];
|
||||
}
|
||||
|
||||
@ -4770,6 +4771,10 @@ fu_device_emit_request(FuDevice *self, FwupdRequest *request)
|
||||
g_critical("a request must have an assigned ID");
|
||||
return;
|
||||
}
|
||||
if (fwupd_request_get_kind(request) >= FWUPD_REQUEST_KIND_LAST) {
|
||||
g_critical("invalid request kind");
|
||||
return;
|
||||
}
|
||||
|
||||
/* ensure set */
|
||||
fwupd_request_set_device_id(request, fu_device_get_id(self));
|
||||
|
Loading…
Reference in New Issue
Block a user