aboutsummaryrefslogtreecommitdiff
path: root/win32/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/process.c')
-rw-r--r--win32/process.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/win32/process.c b/win32/process.c
index 5dc0f7080..5c818a3c0 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -189,6 +189,7 @@ spawnveq(int mode, const char *path, char *const *argv, char *const *env)
189 int i, argc; 189 int i, argc;
190 intptr_t ret; 190 intptr_t ret;
191 struct stat st; 191 struct stat st;
192 size_t len = 0;
192 193
193 /* 194 /*
194 * Require that the file exists, is a regular file and is executable. 195 * Require that the file exists, is a regular file and is executable.
@@ -206,8 +207,10 @@ spawnveq(int mode, const char *path, char *const *argv, char *const *env)
206 207
207 argc = string_array_len((char **)argv); 208 argc = string_array_len((char **)argv);
208 new_argv = xzalloc(sizeof(*argv)*(argc+1)); 209 new_argv = xzalloc(sizeof(*argv)*(argc+1));
209 for (i = 0;i < argc;i++) 210 for (i = 0; i < argc; i++) {
210 new_argv[i] = quote_arg(argv[i]); 211 new_argv[i] = quote_arg(argv[i]);
212 len += strlen(new_argv[i]) + 1;
213 }
211 214
212 /* Special case: spawnve won't execute a batch file if the first 215 /* Special case: spawnve won't execute a batch file if the first
213 * argument is a relative path containing forward slashes. Absolute 216 * argument is a relative path containing forward slashes. Absolute
@@ -234,6 +237,8 @@ spawnveq(int mode, const char *path, char *const *argv, char *const *env)
234 237
235 errno = 0; 238 errno = 0;
236 ret = spawnve(mode, new_path ? new_path : path, new_argv, env); 239 ret = spawnve(mode, new_path ? new_path : path, new_argv, env);
240 if (errno == EINVAL && len > bb_arg_max())
241 errno = E2BIG;
237 242
238 done: 243 done:
239 for (i = 0;i < argc;i++) 244 for (i = 0;i < argc;i++)