diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-08 06:43:14 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-11-08 06:43:14 +0000 |
commit | 31b3856276ef3635365aeb19237306c954fd1317 (patch) | |
tree | 7f6e3c4b45359409bf57526308837f5dbbc45905 /string.c | |
parent | e9d603caf98becdedd3962c718b5756e424c6788 (diff) | |
download | ruby-31b3856276ef3635365aeb19237306c954fd1317.tar.gz ruby-31b3856276ef3635365aeb19237306c954fd1317.tar.xz ruby-31b3856276ef3635365aeb19237306c954fd1317.zip |
* process.c (security): always give warning for insecure PATH.
* dir.c (my_getcwd): do not rely on MAXPATHLEN.
* file.c (rb_file_s_readlink): ditto.
* file.c (path_check_1): ditto.
* eval.c (rb_yield_0): should not call rb_f_block_given_p().
* string.c (rb_str_chomp_bang): should terminate string by NUL.
* eval.c (rb_yield_0): better error message.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -291,6 +291,8 @@ rb_str_dup(str) } else if (RSTRING(str)->orig) { str2 = rb_str_new3(RSTRING(str)->orig); + FL_UNSET(str2, FL_TAINT); + OBJ_INFECT(str2, str); } else { str2 = rb_str_new3(rb_str_new4(str)); @@ -2673,13 +2675,15 @@ rb_str_chomp_bang(argc, argv, str) RSTRING(str)->ptr[RSTRING(str)->len-1] == '\r') { RSTRING(str)->len--; } - return str; } else if (RSTRING(str)->ptr[len-1] == '\r') { RSTRING(str)->len--; - return str; } - return Qnil; + else { + return Qnil; + } + RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; + return str; } } if (NIL_P(rs)) return Qnil; |