summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-20 01:09:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-20 01:09:54 +0000
commitba229f40559da6810dd27f4ff970ad29d7b67259 (patch)
tree761073462f95269dc9da7bf70758e08f3169c593 /error.c
parent48014442b6e272488ac1df286d86a3dc8040d2b4 (diff)
* 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
Diffstat (limited to 'error.c')
-rw-r--r--error.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/error.c b/error.c
index 0b98584..febaad2 100644
--- a/error.c
+++ b/error.c
@@ -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);