chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5660be1
)
cap-list: check range of numeric value
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Tue, 28 Nov 2017 13:06:34 +0000
(22:06 +0900)
committer
Sven Eden
<yamakuzure@gmx.net>
Tue, 28 Nov 2017 13:06:34 +0000
(22:06 +0900)
src/basic/cap-list.c
patch
|
blob
|
history
diff --git
a/src/basic/cap-list.c
b/src/basic/cap-list.c
index 2e9b2d9a550c5be5a90c3230552a6003d504e1a3..2b1779668079c7355e4bffad878ae100146a2098 100644
(file)
--- 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));