ref: cec4decf37b8eab103846cc90cdb3dddd45c71ca
parent: 3f2a01f95577c0486b1ecd01f5d7999ffd705da6
author: Ori Bernstein <[email protected]>
date: Sun Sep 14 22:04:33 EDT 2014
Fix execv{e} buffer size. We were allocating enough, but truncating it. Oops.
--- a/libstd/sys-linux.myr
+++ b/libstd/sys-linux.myr
@@ -628,7 +628,7 @@
/* 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 @@
/* 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])
;;
--- a/libstd/sys-osx.myr
+++ b/libstd/sys-osx.myr
@@ -655,7 +655,7 @@
/* 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 @@
/* 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])
;;