mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 02:50:17 +01:00
device/wwan: ensure capabilities are suitable 32 bit flags
The properties NM_DEVICE_MODEM_CAPABILITIES and NM_DEVICE_MODEM_CURRENT_CAPABILITIES are uint, with a range from zero to G_MAXUINT32. nm_modem_get_capabilities() passes the "untrusted" flags from ModemManager. Ensure that they fit into 32 bit, and don't cause an assertion failure due to the range check. Yes, in practice, on all platforms where we build (known to me), guint is always the same as guint32. So this has little effect. Also, cast to guint. Previously, this was just a C enum NMDeviceModemCapabilities, which theoretically has implementation defined sizes. Yes, in practice, they too are of size guint, and this was not an actual bug. But be specific about converting between different integer types.
This commit is contained in:
parent
d501e96857
commit
64630f57a2
1 changed files with 2 additions and 2 deletions
|
|
@ -762,9 +762,9 @@ nm_device_modem_new(NMModem *modem)
|
|||
NM_DEVICE_MODEM_MODEM,
|
||||
modem,
|
||||
NM_DEVICE_MODEM_CAPABILITIES,
|
||||
caps,
|
||||
(guint) ((guint32) caps),
|
||||
NM_DEVICE_MODEM_CURRENT_CAPABILITIES,
|
||||
current_caps,
|
||||
(guint) ((guint32) current_caps),
|
||||
NM_DEVICE_MODEM_DEVICE_ID,
|
||||
nm_modem_get_device_id(modem),
|
||||
NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue