diff --git a/src/libnm-client-aux-extern/nm-libnm-aux.c b/src/libnm-client-aux-extern/nm-libnm-aux.c index 5855bc299b..77f4a19559 100644 --- a/src/libnm-client-aux-extern/nm-libnm-aux.c +++ b/src/libnm-client-aux-extern/nm-libnm-aux.c @@ -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)); diff --git a/src/libnm-client-impl/nm-client.c b/src/libnm-client-impl/nm-client.c index d2ef43979f..fc30cd0646 100644 --- a/src/libnm-client-impl/nm-client.c +++ b/src/libnm-client-impl/nm-client.c @@ -6316,7 +6316,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 @@ -8313,7 +8313,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