aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/string.c b/string.c
index 8abce208bf..9894423f80 100644
--- a/string.c
+++ b/string.c
@@ -2991,11 +2991,16 @@ rb_str_crypt(str, salt)
VALUE str, salt;
{
extern char *crypt();
+ VALUE result;
StringValue(salt);
if (RSTRING(salt)->len < 2)
rb_raise(rb_eArgError, "salt too short(need >=2 bytes)");
- return rb_tainted_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr));
+
+ result = rb_str_new2(crypt(RSTRING(str)->ptr, RSTRING(salt)->ptr));
+ OBJ_INFECT(result, str);
+ OBJ_INFECT(result, salt);
+ return result;
}
static VALUE