summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstd/sys-linux.myr4
-rw-r--r--libstd/sys-osx.myr4
2 files changed, 4 insertions, 4 deletions
diff --git a/libstd/sys-linux.myr b/libstd/sys-linux.myr
index 0079108..8b787f7 100644
--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -628,7 +628,7 @@ const execv = {cmd, args
/* of course we fucking have to duplicate this code everywhere,
* since we want to stack allocate... */
p = alloca((args.len + 1)*sizeof(byte#))
- cargs = (p castto(byte##))[:args.len]
+ cargs = (p castto(byte##))[:args.len + 1]
for i = 0; i < args.len; i++
cargs[i] = cstring(args[i])
;;
@@ -642,7 +642,7 @@ const execve = {cmd, args, env
/* copy the args */
p = alloca((args.len + 1)*sizeof(byte#))
- cargs = (p castto(byte##))[:args.len]
+ cargs = (p castto(byte##))[:args.len + 1]
for i = 0; i < args.len; i++
cargs[i] = cstring(args[i])
;;
diff --git a/libstd/sys-osx.myr b/libstd/sys-osx.myr
index e34103f..1b73a5a 100644
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -655,7 +655,7 @@ const execv = {cmd, args
/* doesn't just call execve() for efficiency's sake. */
p = alloca((args.len + 1)*sizeof(byte#))
- cargs = (p castto(byte##))[:args.len]
+ cargs = (p castto(byte##))[:args.len + 1]
for i = 0; i < args.len; i++
cargs[i] = cstring(args[i])
;;
@@ -669,7 +669,7 @@ const execve = {cmd, args, env
/* copy the args */
p = alloca((args.len + 1)*sizeof(byte#))
- cargs = (p castto(byte##))[:args.len]
+ cargs = (p castto(byte##))[:args.len + 1]
for i = 0; i < args.len; i++
cargs[i] = cstring(args[i])
;;