* error.c (syserr_initialize): need to allocate an additional byte

for NUL at the end.  [ruby-dev:26574]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-07-19 13:52:42 +00:00
parent 2031602787
commit 30434d4078
3 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Tue Jul 19 22:47:29 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* error.c (syserr_initialize): need to allocate an additional byte
for NUL at the end. [ruby-dev:26574]
Tue Jul 19 17:16:34 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* signal.c (trap): remove sigexit(); handle "EXIT" via sig_exec().

View File

@ -956,7 +956,7 @@ 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 = strlen(err)+RSTRING(str)->len+4;
StringValue(str);
mesg = rb_str_new(0, len);
snprintf(RSTRING(mesg)->ptr, len, "%s - %.*s", err,

2
eval.c
View File

@ -8667,7 +8667,7 @@ proc_to_s(self)
NODE *node;
char *cname = rb_obj_classname(self);
const int w = (SIZEOF_LONG * CHAR_BIT) / 4;
long len = strlen(cname)+6+w; /* 6:tags 16:addr */
long len = strlen(cname)+6+w+1; /* 6:tags 16:addr NUL */
VALUE str;
Data_Get_Struct(self, struct BLOCK, data);