diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-30 08:35:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-30 08:35:23 +0000 |
commit | 1852b4a8660ee8e71997f81cee4903c6eb23f306 (patch) | |
tree | 651e33765db8a4d18ab102ea1ef38fc6f5deafc2 /ext/syslog/syslog.c | |
parent | d00c9d7e0609f6d9b6141e1dde6fa9321de70b85 (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/syslog/syslog.c')
-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 5351b28fe6..317607eeef 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; |