capability_ambient_set_apply() can be called with capability sets
containing unknown capabilities. Let's not crash when this is the
case but instead ignore the unknown capabilities.
This fixes a crash when running the following command:
"systemd-run -p "AmbientCapabilities=~" --wait --pipe id"
Fixes
d5e12dc75e0e356c62e514e9c347efb200fe60e0
int r;
/* Remove capabilities requested in ambient set, but not in the bounding set */
- BIT_FOREACH(i, set) {
- assert((unsigned) i <= cap_last_cap());
+ for (unsigned i = 0; i <= cap_last_cap(); i++) {
+ if (!BIT_SET(set, i))
+ continue;
if (prctl(PR_CAPBSET_READ, (unsigned long) i) != 1) {
log_debug("Ambient capability %s requested but missing from bounding set, suppressing automatically.",