summaryrefslogtreecommitdiff
path: root/ext/psych
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-31 07:24:29 (GMT)
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-31 07:24:29 (GMT)
commit865decb508e89960382fc41d239be3e42545b68a (patch)
treebff7bfa5153a329740cebc1ff600ddea7cbeaaed /ext/psych
parentbd46dad47fd1e7a8bc7bacdcd608ae00dcb7efa2 (diff)
null byte at Psych::Emitter.
Check null byte. Patched by tommy (Masahiro Tomita). [Bug #13993][ruby-dev:50285] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych')
-rw-r--r--ext/psych/psych_emitter.c14
-rw-r--r--ext/psych/psych_yaml_tree.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/ext/psych/psych_emitter.c b/ext/psych/psych_emitter.c
index bb4c4b2..55bd417 100644
--- a/ext/psych/psych_emitter.c
+++ b/ext/psych/psych_emitter.c
@@ -272,8 +272,8 @@ static VALUE scalar(
yaml_scalar_event_initialize(
&event,
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)),
- (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)),
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
+ (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
(yaml_char_t*)StringValuePtr(value),
(int)RSTRING_LEN(value),
plain ? 1 : 0,
@@ -319,8 +319,8 @@ static VALUE start_sequence(
yaml_sequence_start_event_initialize(
&event,
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)),
- (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)),
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
+ (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
implicit ? 1 : 0,
(yaml_sequence_style_t)NUM2INT(style)
);
@@ -383,8 +383,8 @@ static VALUE start_mapping(
yaml_mapping_start_event_initialize(
&event,
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor)),
- (yaml_char_t *)(NIL_P(tag) ? NULL : StringValuePtr(tag)),
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
+ (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
implicit ? 1 : 0,
(yaml_mapping_style_t)NUM2INT(style)
);
@@ -432,7 +432,7 @@ static VALUE alias(VALUE self, VALUE anchor)
yaml_alias_event_initialize(
&event,
- (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValuePtr(anchor))
+ (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor))
);
emit(emitter, &event);
diff --git a/ext/psych/psych_yaml_tree.c b/ext/psych/psych_yaml_tree.c
index bcf24d2..7aca911 100644
--- a/ext/psych/psych_yaml_tree.c
+++ b/ext/psych/psych_yaml_tree.c
@@ -9,7 +9,7 @@ VALUE cPsychVisitorsYamlTree;
*/
static VALUE private_iv_get(VALUE self, VALUE target, VALUE prop)
{
- return rb_attr_get(target, rb_intern(StringValuePtr(prop)));
+ return rb_attr_get(target, rb_intern(StringValueCStr(prop)));
}
void Init_psych_yaml_tree(void)