summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-09-15 02:04:33 -0400
committerOri Bernstein <ori@eigenstate.org>2014-09-15 02:04:33 -0400
commitcec4decf37b8eab103846cc90cdb3dddd45c71ca (patch)
tree8dab9a5ea0134a2c062981be3885bf70067396ea
parent3f2a01f95577c0486b1ecd01f5d7999ffd705da6 (diff)
downloadmc-cec4decf37b8eab103846cc90cdb3dddd45c71ca.tar.gz
Fix execv{e} buffer size.
We were allocating enough, but truncating it. Oops.
-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])
;;