mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* 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
This commit is contained in:
parent
1fb55b9d77
commit
2031602787
10 changed files with 50 additions and 47 deletions
5
struct.c
5
struct.c
|
@ -477,9 +477,10 @@ inspect_struct(s, dummy, recur)
|
|||
|
||||
if (recur) {
|
||||
char *cname = rb_class2name(rb_obj_class(s));
|
||||
VALUE str = rb_str_new(0, strlen(cname) + 15);
|
||||
size_t len = strlen(cname) + 15;
|
||||
VALUE str = rb_str_new(0, len);
|
||||
|
||||
sprintf(RSTRING(str)->ptr, "#<struct %s:...>", cname);
|
||||
snprintf(RSTRING(str)->ptr, len, "#<struct %s:...>", cname);
|
||||
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue