summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/error.c b/error.c
index 7dacac8ce5..0b98584c54 100644
--- a/error.c
+++ b/error.c
@@ -907,10 +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+4;
+ size_t len = strlen(err)+RSTRING(str)->len+3;
StringValue(str);
mesg = rb_str_new(0, len);
- snprintf(RSTRING(mesg)->ptr, len, "%s - %.*s", err,
+ snprintf(RSTRING(mesg)->ptr, len+1, "%s - %.*s", err,
(int)RSTRING(str)->len, RSTRING(str)->ptr);
rb_str_resize(mesg, strlen(RSTRING(mesg)->ptr));
}