summaryrefslogtreecommitdiff
path: root/ext/cgi/escape
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-02 08:02:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-02 08:02:36 +0000
commitc373866444f9f2ad35467ed262e5455679824e48 (patch)
tree30a67e84a6ab8e527a31fa91eac278c885608380 /ext/cgi/escape
parentffcb389d6815e20fcc8588a37c0109c4d3bd72d1 (diff)
escape.c: check argument
* ext/cgi/escape/escape.c (optimized_unescape): check accept_charset encoding argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/cgi/escape')
-rw-r--r--ext/cgi/escape/escape.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/cgi/escape/escape.c b/ext/cgi/escape/escape.c
index 7289f43..fa3d6c2 100644
--- a/ext/cgi/escape/escape.c
+++ b/ext/cgi/escape/escape.c
@@ -252,7 +252,8 @@ optimized_unescape(VALUE str, VALUE encoding)
long i, len, beg = 0;
VALUE dest = 0;
const char *cstr;
- int cr, origenc, encidx = rb_to_encoding_index(encoding);
+ rb_encoding *enc = rb_to_encoding(encoding);
+ int cr, origenc, encidx = rb_enc_to_index(enc);
len = RSTRING_LEN(str);
cstr = RSTRING_PTR(str);