mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
cap-list: check range of numeric value
This commit is contained in:
parent
6b86b9e65d
commit
db4bd5bd62
@ -54,8 +54,12 @@ int capability_from_name(const char *name) {
|
||||
|
||||
/* Try to parse numeric capability */
|
||||
r = safe_atoi(name, &i);
|
||||
if (r >= 0 && i >= 0)
|
||||
return i;
|
||||
if (r >= 0) {
|
||||
if (i >= 0 && i < (int) ELEMENTSOF(capability_names))
|
||||
return i;
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Try to parse string capability */
|
||||
sc = lookup_capability(name, strlen(name));
|
||||
|
Loading…
Reference in New Issue
Block a user