minijail0: parse *all* the arguments!
Using strtok the way we did causes src == dest == writeable - oops.
BUG=none
TEST=security_Minijail0
Change-Id: Ifc8e6e528e93549b64b23e6ac46dbee4e54ddad7
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/12555
Reviewed-by: Jim Hebert <jimhebert@chromium.org>
diff --git a/minijail0.c b/minijail0.c
index 5ef57fb..0559f55 100644
--- a/minijail0.c
+++ b/minijail0.c
@@ -55,8 +55,8 @@
static void add_binding(struct minijail *j, char *arg) {
char *src = strtok(arg, ",");
- char *dest = strtok(arg, ",");
- char *flags = strtok(arg, ",");
+ char *dest = strtok(NULL, ",");
+ char *flags = strtok(NULL, ",");
if (!src || !dest) {
fprintf(stderr, "Bad binding: %s %s\n", src, dest);
exit(1);