From 7be16f51b373394318d2bdde5d306e829ba9be0e Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 26 Jun 2018 06:05:20 +0200 Subject: [PATCH] core: execl_: Allow 1000 arguments. * src/posix.c (execl_): Allow 1000 arguments. --- src/posix.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/posix.c b/src/posix.c index fc7ddd49..60b9c091 100644 --- a/src/posix.c +++ b/src/posix.c @@ -270,15 +270,20 @@ primitive_fork () SCM execl_ (SCM file_name, SCM args) ///((name . "execl")) { - char *c_argv[100]; + char *c_argv[1000]; // POSIX minimum 4096 int i = 0; - int n = 0; + int n = n; + + if (length__ (args) > 1000) + error (cell_symbol_system_error, + cons (file_name, + cons (MAKE_STRING (cstring_to_list ("too many arguments")), + cons (file_name, args)))); c_argv[i++] = string_to_cstring_ (file_name, string_to_cstring_buf+n); n += length__ (STRING (file_name)) + 1; while (args != cell_nil) { assert (TYPE (CAR (args)) == TSTRING); - assert (i < 20); c_argv[i++] = string_to_cstring_ (CAR (args), string_to_cstring_buf+n); n += length__ (STRING (CAR (args))) + 1; args = CDR (args);