Commit 2caf9a97 by Serge Hallyn

sanity-check number of detected capabilities

parent 3a1675bf
...@@ -1852,6 +1852,9 @@ static int dropcaps_except(struct lxc_list *caps) ...@@ -1852,6 +1852,9 @@ static int dropcaps_except(struct lxc_list *caps)
int numcaps = lxc_caps_last_cap() + 1; int numcaps = lxc_caps_last_cap() + 1;
INFO("found %d capabilities\n", numcaps); INFO("found %d capabilities\n", numcaps);
if (numcaps <= 0 || numcaps > 200)
return -1;
// caplist[i] is 1 if we keep capability i // caplist[i] is 1 if we keep capability i
int *caplist = alloca(numcaps * sizeof(int)); int *caplist = alloca(numcaps * sizeof(int));
memset(caplist, 0, numcaps * sizeof(int)); memset(caplist, 0, numcaps * sizeof(int));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment