mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.c (set_arg0): get rids of overrun.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a6239ec352
commit
214e725334
3 changed files with 10 additions and 23 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sun May 17 08:55:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ruby.c (set_arg0): get rids of overrun.
|
||||||
|
|
||||||
Sat May 16 18:38:32 2009 Kouhei Sutou <kou@cozmixng.org>
|
Sat May 16 18:38:32 2009 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/parser.rb: add nil check.
|
* lib/rss/parser.rb: add nil check.
|
||||||
|
|
25
ruby.c
25
ruby.c
|
@ -124,7 +124,7 @@ static struct {
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE)
|
#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE)
|
||||||
int len;
|
size_t len;
|
||||||
#endif
|
#endif
|
||||||
} origarg;
|
} origarg;
|
||||||
|
|
||||||
|
@ -1623,7 +1623,7 @@ rb_load_file(const char *fname)
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static size_t
|
||||||
get_arglen(int argc, char **argv)
|
get_arglen(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *s = argv[0];
|
char *s = argv[0];
|
||||||
|
@ -1686,7 +1686,7 @@ set_arg0(VALUE val, ID id)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (i >= origarg.len) {
|
if (i >= origarg.len) {
|
||||||
i = origarg.len;
|
i = origarg.len - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(origarg.argv[0], s, i);
|
memcpy(origarg.argv[0], s, i);
|
||||||
|
@ -1823,24 +1823,7 @@ ruby_process_options(int argc, char **argv)
|
||||||
void
|
void
|
||||||
ruby_sysinit(int *argc, char ***argv)
|
ruby_sysinit(int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__) && (defined(__MACH__) || defined(__DARWIN__))
|
#if defined(_WIN32)
|
||||||
int i, n = *argc, len = 0;
|
|
||||||
char **v1 = *argv, **v2, *p;
|
|
||||||
|
|
||||||
for (i = 0; i < n; ++i) {
|
|
||||||
len += strlen(v1[i]) + 1;
|
|
||||||
}
|
|
||||||
v2 = malloc((n + 1)* sizeof(char*) + len);
|
|
||||||
p = (char *)&v2[n + 1];
|
|
||||||
for (i = 0; i < n; ++i) {
|
|
||||||
int l = strlen(v1[i]);
|
|
||||||
memcpy(p, v1[i], l + 1);
|
|
||||||
v2[i] = p;
|
|
||||||
p += l + 1;
|
|
||||||
}
|
|
||||||
v2[n] = 0;
|
|
||||||
*argv = v2;
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
void rb_w32_sysinit(int *argc, char ***argv);
|
void rb_w32_sysinit(int *argc, char ***argv);
|
||||||
rb_w32_sysinit(argc, argv);
|
rb_w32_sysinit(argc, argv);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define RUBY_VERSION "1.9.2"
|
#define RUBY_VERSION "1.9.2"
|
||||||
#define RUBY_RELEASE_DATE "2009-05-16"
|
#define RUBY_RELEASE_DATE "2009-05-17"
|
||||||
#define RUBY_PATCHLEVEL -1
|
#define RUBY_PATCHLEVEL -1
|
||||||
#define RUBY_BRANCH_NAME "trunk"
|
#define RUBY_BRANCH_NAME "trunk"
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
#define RUBY_VERSION_TEENY 1
|
#define RUBY_VERSION_TEENY 1
|
||||||
#define RUBY_RELEASE_YEAR 2009
|
#define RUBY_RELEASE_YEAR 2009
|
||||||
#define RUBY_RELEASE_MONTH 5
|
#define RUBY_RELEASE_MONTH 5
|
||||||
#define RUBY_RELEASE_DAY 16
|
#define RUBY_RELEASE_DAY 17
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue