mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +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 */
|
/* Try to parse numeric capability */
|
||||||
r = safe_atoi(name, &i);
|
r = safe_atoi(name, &i);
|
||||||
if (r >= 0 && i >= 0)
|
if (r >= 0) {
|
||||||
return i;
|
if (i >= 0 && i < (int) ELEMENTSOF(capability_names))
|
||||||
|
return i;
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to parse string capability */
|
/* Try to parse string capability */
|
||||||
sc = lookup_capability(name, strlen(name));
|
sc = lookup_capability(name, strlen(name));
|
||||||
|
Loading…
Reference in New Issue
Block a user