diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-05-25 15:01:48 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-05-25 15:01:48 +0000 |
commit | 67355a8c56b8d3a44aa336a31ec3db116cba45e9 (patch) | |
tree | c9ee3a2a40a06581c37296a3c8435c1494cf5993 /string.c | |
parent | 8a8d0b2cd1bfda4f6266e108da5f11cd3c54d1da (diff) |
* string.c (rb_str_replace): add taint status infection
(OBJ_INFECT()).
* string.c (rb_str_crypt): ditto.
* string.c (rb_str_ljust): ditto.
* string.c (rb_str_rjust): ditto.
* string.c (rb_str_center): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -968,6 +968,7 @@ rb_str_replace(str, beg, len, val) } RSTRING(str)->len += RSTRING(val)->len - len; RSTRING(str)->ptr[RSTRING(str)->len] = '\0'; + OBJ_INFECT(str, val); } static VALUE rb_str_sub_bang _((int, VALUE*, VALUE)); @@ -2634,11 +2635,15 @@ rb_str_crypt(str, salt) VALUE str, salt; { extern char *crypt(); + VALUE result; if (TYPE(salt) != T_STRING) salt = rb_str_to_str(salt); if (RSTRING(salt)->len < 2) rb_raise(rb_eArgError, "salt too short(need >=2 bytes)"); - return rb_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr)); + + result = rb_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr)); + OBJ_INFECT(result, str); + return result; } static VALUE @@ -2715,6 +2720,7 @@ rb_str_ljust(str, w) while (p < pend) { *p++ = ' '; } + OBJ_INFECT(res, str); return res; } @@ -2734,6 +2740,7 @@ rb_str_rjust(str, w) *p++ = ' '; } memcpy(pend, RSTRING(str)->ptr, RSTRING(str)->len); + OBJ_INFECT(res, str); return res; } @@ -2759,6 +2766,7 @@ rb_str_center(str, w) while (p < pend) { *p++ = ' '; } + OBJ_INFECT(res, str); return res; } |