diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-04 11:01:41 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-06-04 11:01:41 +0000 |
commit | 71fd73dff88fa29b41f92e39412d31ad651dbea4 (patch) | |
tree | b56ef7e77a70c2c7655735a911546a9a9ab955b6 /process.c | |
parent | 41819dc447067891a2154f1c99c0cb4589f7b73f (diff) | |
download | ruby-71fd73dff88fa29b41f92e39412d31ad651dbea4.tar.gz |
* process.c (rb_exec_fillarg): allocate one more element before
beginning in argv_str for try_with_sh.
* internal.h (ARGVSTR2ARGC): adjust for the above change.
(ARGVSTR2ARGV): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1843,17 +1843,17 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, str } if (e->argv_buf) { - char *p, *ep; + char *p, *ep, *null=NULL; VALUE argv_str; - argv_str = hide_obj(rb_str_buf_new(sizeof(char*) * (argc + 1))); + argv_str = hide_obj(rb_str_buf_new(sizeof(char*) * (argc + 2))); + rb_str_buf_cat(argv_str, (char *)&null, sizeof(null)); /* place holder for /bin/sh of try_with_sh. */ p = RSTRING_PTR(e->argv_buf); ep = p + RSTRING_LEN(e->argv_buf); while (p < ep) { rb_str_buf_cat(argv_str, (char *)&p, sizeof(p)); p += strlen(p) + 1; } - p = NULL; - rb_str_buf_cat(argv_str, (char *)&p, sizeof(p)); + rb_str_buf_cat(argv_str, (char *)&null, sizeof(null)); /* terminator for execve. */ e->argv_str = argv_str; } } |