cap_last_cap() returns the last valid cap (instead of the number of
valid caps). to iterate through all known caps we hence need to use a <=
check, and not a < check like for all other cases. We got this right
usually, but in three cases we did not.
assert(s);
- for (i = 0; i < cap_last_cap(); i++)
+ for (i = 0; i <= cap_last_cap(); i++)
if (set & (UINT64_C(1) << i)) {
const char *p;
size_t add;
/* Add capabilities in the set to the inherited caps. Do not apply
* them yet. */
- for (i = 0; i < cap_last_cap(); i++) {
+ for (i = 0; i <= cap_last_cap(); i++) {
if (set & (UINT64_C(1) << i)) {
cap_value_t v;
return -errno;
}
- for (i = 0; i < cap_last_cap(); i++) {
+ for (i = 0; i <= cap_last_cap(); i++) {
if (set & (UINT64_C(1) << i)) {