aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-10 02:49:01 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-10 02:49:01 +0000
commitf64ac5d4cd1b96fb71da0955ea9f322e8feac290 (patch)
tree6cddc121ed20437e4a81e00428258601b7c5e77f /string.c
parentd90818016436a069590277c5fb07a4f50c2feb87 (diff)
downloadruby-f64ac5d4cd1b96fb71da0955ea9f322e8feac290.tar.gz
* string.c (rb_str_crypt): Raise ArgumentError when
string passed to String#crypt contains null. the patch is from jrusnack <jrusnack at redhat.com>. [Bug #10988] [fix GH-853] * test/ruby/test_string.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/string.c b/string.c
index d85033ea6c..7e18f69027 100644
--- a/string.c
+++ b/string.c
@@ -7711,8 +7711,7 @@ rb_str_crypt(VALUE str, VALUE salt)
rb_raise(rb_eArgError, "salt too short (need >=2 bytes)");
}
- s = RSTRING_PTR(str);
- if (!s) s = "";
+ s = StringValueCStr(str);
saltp = RSTRING_PTR(salt);
if (!saltp[0] || !saltp[1]) goto short_salt;
#ifdef BROKEN_CRYPT