diff options
-rw-r--r-- | src/firejail/no_sandbox.c | 5 | ||||
-rw-r--r-- | src/firejail/run_symlink.c | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/firejail/no_sandbox.c b/src/firejail/no_sandbox.c index 9672d003e..f6ad3d472 100644 --- a/src/firejail/no_sandbox.c +++ b/src/firejail/no_sandbox.c | |||
@@ -180,7 +180,7 @@ void run_no_sandbox(int argc, char **argv) { | |||
180 | } | 180 | } |
181 | int start_index = i; | 181 | int start_index = i; |
182 | for (i = start_index; i < argc; i++) | 182 | for (i = start_index; i < argc; i++) |
183 | len += strlen(argv[i]) + 1; | 183 | len += strlen(argv[i]) + 3; |
184 | 184 | ||
185 | // allocate | 185 | // allocate |
186 | command = malloc(len + 1); | 186 | command = malloc(len + 1); |
@@ -191,8 +191,9 @@ void run_no_sandbox(int argc, char **argv) { | |||
191 | 191 | ||
192 | // copy | 192 | // copy |
193 | for (i = start_index; i < argc; i++) { | 193 | for (i = start_index; i < argc; i++) { |
194 | strcat(command, "\""); | ||
194 | strcat(command, argv[i]); | 195 | strcat(command, argv[i]); |
195 | strcat(command, " "); | 196 | strcat(command, "\" "); |
196 | } | 197 | } |
197 | } | 198 | } |
198 | 199 | ||
diff --git a/src/firejail/run_symlink.c b/src/firejail/run_symlink.c index cc6f6b3e9..554d243e5 100644 --- a/src/firejail/run_symlink.c +++ b/src/firejail/run_symlink.c | |||
@@ -102,8 +102,13 @@ void run_symlink(int argc, char **argv) { | |||
102 | a[0] = firejail; | 102 | a[0] = firejail; |
103 | a[1] = program; | 103 | a[1] = program; |
104 | int i; | 104 | int i; |
105 | for (i = 0; i < (argc - 1); i++) | 105 | for (i = 0; i < (argc - 1); i++) { |
106 | a[i + 2] = argv[i + 1]; | 106 | char *str = malloc(strlen(argv[i + 1])); |
107 | if (str == NULL) | ||
108 | errExit("malloc"); | ||
109 | sprintf(str, "\"%s\"", argv[i + 1]); | ||
110 | a[i + 2] = str; | ||
111 | } | ||
107 | a[i + 2] = NULL; | 112 | a[i + 2] = NULL; |
108 | execvp(a[0], a); | 113 | execvp(a[0], a); |
109 | 114 | ||