1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* variable.c (rb_class_path): need to adjust snprintf() len for

teminating NUL.  [ruby-dev:26581]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-07-20 01:09:54 +00:00
parent 48014442b6
commit ba229f4055
3 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Wed Jul 20 10:04:51 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* variable.c (rb_class_path): need to adjust snprintf() len for
teminating NUL. [ruby-dev:26581]
Wed Jul 20 04:01:55 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* ext/socket/socket.c: sorry, BeOS also uses HAVE_CLOSESOCKET,
@ -12,6 +17,11 @@ Wed Jul 20 03:16:43 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
it's defined to rb_w32_close(), otherwise handle leaks.
[ruby-Bugs-2131]
Wed Jul 20 00:48:16 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* error.c (syserr_initialize): don't use str before StringValue()
check. [ruby-dev:26579]
Tue Jul 19 22:47:29 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* error.c (syserr_initialize): add 1 byte for snprintf() size for

View file

@ -907,8 +907,10 @@ syserr_initialize(argc, argv, self)
else err = "unknown error";
if (!NIL_P(mesg)) {
VALUE str = mesg;
size_t len = strlen(err)+RSTRING(str)->len+3;
size_t len;
StringValue(str);
len = strlen(err)+RSTRING(str)->len+3;
mesg = rb_str_new(0, len);
snprintf(RSTRING(mesg)->ptr, len+1, "%s - %.*s", err,
(int)RSTRING(str)->len, RSTRING(str)->ptr);

View file

@ -208,7 +208,7 @@ rb_class_path(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);
snprintf(RSTRING(path)->ptr, len+1, "#<%s:0x%lx>", s, klass);
RSTRING(path)->len = strlen(RSTRING(path)->ptr);
rb_ivar_set(klass, tmp_classpath, path);