summaryrefslogtreecommitdiff
path: root/src/basic/cap-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/cap-list.c')
-rw-r--r--src/basic/cap-list.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/basic/cap-list.c b/src/basic/cap-list.c
index 2e9b2d9a5..2b1779668 100644
--- a/src/basic/cap-list.c
+++ b/src/basic/cap-list.c
@@ -53,8 +53,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));