summaryrefslogtreecommitdiff
path: root/ext/nkf
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-30 08:35:23 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-30 08:35:23 (GMT)
commit1852b4a8660ee8e71997f81cee4903c6eb23f306 (patch)
tree651e33765db8a4d18ab102ea1ef38fc6f5deafc2 /ext/nkf
parentd00c9d7e0609f6d9b6141e1dde6fa9321de70b85 (diff)
ext: check if null byte is contained
[ruby-dev:50267] [Bug #13953] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf')
-rw-r--r--ext/nkf/nkf.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 9613a92..c958c91 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -137,8 +137,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
{
VALUE tmp;
reinit();
- StringValue(opt);
- nkf_split_options(RSTRING_PTR(opt));
+ nkf_split_options(StringValueCStr(opt));
if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given");
switch (nkf_enc_to_index(output_encoding)) {
@@ -153,8 +152,7 @@ rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
incsize = INCSIZE;
input_ctr = 0;
- StringValue(src);
- input = (unsigned char *)RSTRING_PTR(src);
+ input = (unsigned char *)StringValuePtr(src);
i_len = RSTRING_LENINT(src);
tmp = rb_str_new(0, i_len*3 + 10);
@@ -195,8 +193,7 @@ rb_nkf_guess(VALUE obj, VALUE src)
reinit();
input_ctr = 0;
- StringValue(src);
- input = (unsigned char *)RSTRING_PTR(src);
+ input = (unsigned char *)StringValuePtr(src);
i_len = RSTRING_LENINT(src);
guess_f = TRUE;