diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-07-19 08:31:04 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-07-19 08:31:04 +0000 |
commit | 20316027872b9a3a70babc884f838f499f1e5746 (patch) | |
tree | ffade6e5d1945bcecdd7236487b5f94a59b501a6 /variable.c | |
parent | 1fb55b9d7704c4e3df0118fe33890b65538dd06a (diff) | |
download | ruby-20316027872b9a3a70babc884f838f499f1e5746.tar.gz |
* signal.c (trap): remove sigexit(); handle "EXIT" via sig_exec().
[ruby-dev:26440]
* io.c (rb_io_inspect): replace sprintf() with "%s" format all
over the place by snprintf() to avoid integer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/variable.c b/variable.c index 8b3ca3bc61..02483fe8af 100644 --- a/variable.c +++ b/variable.c @@ -196,6 +196,7 @@ rb_class_path(klass) } else { char *s = "Class"; + size_t len; if (TYPE(klass) == T_MODULE) { if (rb_obj_class(klass) == rb_cModule) { @@ -205,8 +206,9 @@ rb_class_path(klass) s = rb_class2name(RBASIC(klass)->klass); } } - path = rb_str_new(0, 2 + strlen(s) + 3 + 2 * SIZEOF_LONG + 1); - sprintf(RSTRING(path)->ptr, "#<%s:0x%lx>", s, klass); + len = 2 + strlen(s) + 3 + 2 * SIZEOF_LONG + 1; + path = rb_str_new(0, len); + snprintf(RSTRING(path)->ptr, len, "#<%s:0x%lx>", s, klass); RSTRING(path)->len = strlen(RSTRING(path)->ptr); rb_ivar_set(klass, tmp_classpath, path); |