mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 00:10:15 +01:00
libnmc: fix bug checking VersionInfo's capabilities
Remove the `+ 31u` that was making that it would search for bit 1 at array's element 1, instead of element 0. Fixed comparison >len that shoudl be >=len. Fix a few typos. Fixes:bc6098d441('libnm: add internal nmc_client_has_{version_info_v,version_info_capability,capability}() helper') (cherry picked from commit5a65170b49)
This commit is contained in:
parent
b9a733d00b
commit
a53349fa9c
2 changed files with 6 additions and 9 deletions
|
|
@ -169,14 +169,11 @@ nmc_client_has_version_info_capability(NMClient *nmc, NMVersionInfoCapability ca
|
|||
len--;
|
||||
ver++;
|
||||
|
||||
idx = (gsize) capability;
|
||||
if (idx >= G_MAXSIZE - 31u)
|
||||
return FALSE;
|
||||
idx = (gsize) capability;
|
||||
idx_hi = idx / 32u;
|
||||
idx_lo = idx % 32u;
|
||||
|
||||
idx_hi = ((idx + 31u) / 32u);
|
||||
idx_lo = (idx % 32u);
|
||||
|
||||
if (idx_hi > len)
|
||||
if (idx_hi >= len)
|
||||
return FALSE;
|
||||
|
||||
return NM_FLAGS_ANY(ver[idx_hi], (1ull << idx_lo));
|
||||
|
|
|
|||
|
|
@ -6315,7 +6315,7 @@ nm_client_get_capabilities(NMClient *client, gsize *length)
|
|||
*
|
||||
* If available, the first element in the array is NM_VERSION which
|
||||
* encodes the daemon version as "(major << 16 | minor << 8 | micro)".
|
||||
* The following elements are a bitfield of %NMVersionInfoCapabilities
|
||||
* The following elements are a bitfield of %NMVersionInfoCapability
|
||||
* that indicate that the daemon supports a certain capability.
|
||||
*
|
||||
* Returns: (transfer none) (array length=length): the
|
||||
|
|
@ -8312,7 +8312,7 @@ nm_client_class_init(NMClientClass *client_class)
|
|||
* Expose version info and capabilities of NetworkManager. If non-empty,
|
||||
* the first element is NM_VERSION, which encodes the version of the
|
||||
* daemon as "(major << 16 | minor << 8 | micro)". The following elements
|
||||
* is a bitfields of %NMVersionInfoCapabilities. If a bit is set, then
|
||||
* is a bitfields of %NMVersionInfoCapability. If a bit is set, then
|
||||
* the running NetworkManager has the respective capability.
|
||||
*
|
||||
* Since: 1.42
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue