summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-02 06:46:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-02 06:46:42 +0000
commit8148b7013c1b08df4fb7bd87bfc699f1f929e540 (patch)
tree466b40286a32eda2c5329fa753fef330aa9e12fb /io.c
parent85847e78a0614d1f3373f22811ec6562fc0c2dc5 (diff)
io.c: check null char
* io.c (ruby_set_inplace_mode): check if null is contained. based on the patch by tommy (Masahiro Tomita) in [ruby-dev:50272]. [Bug #13960] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index 1254e92363..6226108ad6 100644
--- a/io.c
+++ b/io.c
@@ -12224,10 +12224,10 @@ argf_inplace_mode_set(VALUE argf, VALUE val)
ARGF.inplace = 0;
}
else {
- StringValue(val);
+ const char *suffix = StringValueCStr(val);
if (ARGF.inplace) free(ARGF.inplace);
ARGF.inplace = 0;
- ARGF.inplace = strdup(RSTRING_PTR(val));
+ ARGF.inplace = strdup(suffix);
}
return argf;
}