diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-24 20:06:32 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-24 20:06:32 +0000 |
commit | 76940d8a763a45defd36a26bec4159c500d026e4 (patch) | |
tree | dcb470ea28150336a808c7afc23407f17109f83e /ext/syslog | |
parent | 58d3ef7778a1bfb9116f282f9cc70224cd943217 (diff) |
merge revision(s) 60071: [Backport #13953] [Backport #13954] [Backport #13955] [Backport #13957]
ext: check if null byte is contained
[ruby-dev:50267] [Bug #13953]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@61456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syslog')
-rw-r--r-- | ext/syslog/syslog.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c index 9c41795f5b..37c9d0bf0c 100644 --- a/ext/syslog/syslog.c +++ b/ext/syslog/syslog.c @@ -150,6 +150,7 @@ static VALUE mSyslog_close(VALUE self) static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self) { VALUE ident, opt, fac; + const char *ident_ptr; if (syslog_opened) { rb_raise(rb_eRuntimeError, "syslog already open"); @@ -160,8 +161,9 @@ static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self) if (NIL_P(ident)) { ident = rb_gv_get("$0"); } - SafeStringValue(ident); - syslog_ident = strdup(RSTRING_PTR(ident)); + ident_ptr = StringValueCStr(ident); + rb_check_safe_obj(ident); + syslog_ident = strdup(ident_ptr); if (NIL_P(opt)) { syslog_options = LOG_PID | LOG_CONS; |