diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-02-13 00:59:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-02-13 00:59:00 +0000 |
commit | 2f6595c1edc2b7768a814e4cf2651c1da4e7cede (patch) | |
tree | 5326e41ff41c2bfe103c764b88575c3110afc80c /ruby.c | |
parent | 168f2f470f42033364fe374f199a4beb8180baec (diff) | |
download | ruby-2f6595c1edc2b7768a814e4cf2651c1da4e7cede.tar.gz |
* ruby.c (ruby_init_loadpath): ensures buffer terminated
before use strncpy().
* ruby.c (proc_options): avoid SEGV at -S with no arguments.
(ruby-bugs-ja:PR#391)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -255,6 +255,7 @@ ruby_init_loadpath() _execname(libpath, FILENAME_MAX); #endif + libpath[FILENAME_MAX] = '\0'; #ifdef DOSISH translate_char(libpath, '\\', '/'); #endif @@ -704,14 +705,14 @@ proc_options(argc, argv) OBJ_TAINT(rb_load_path); } - if (!e_script && argc == 0) { /* no more args */ - if (verbose) exit(0); - script = "-"; - } - else { + if (argc == 0) { /* no more args */ if (!e_script) { - script = argv[0]; + if (verbose) exit(0); + script = "-"; } + } + else if (!e_script) { + script = argv[0]; if (script[0] == '\0') { script = "-"; } @@ -728,13 +729,11 @@ proc_options(argc, argv) } if (!script) script = argv[0]; } - } - if (!e_script) { - argc--; argv++; - } #ifdef DOSISH - translate_char(script, '\\', '/'); + translate_char(script, '\\', '/'); #endif + } + argc--; argv++; } ruby_script(script); |