From 2201229b4aebd2ebb08eae05ff197f0adfd4f4e5 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 20 Jul 2005 01:08:13 +0000 Subject: * variable.c (rb_class_path): need to adjust snprintf() len for teminating NUL. [ruby-dev:26581] * error.c (syserr_initialize): don't use str before StringValue() check. [ruby-dev:26579] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- variable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'variable.c') diff --git a/variable.c b/variable.c index 02483fe8af..1139b016ca 100644 --- a/variable.c +++ b/variable.c @@ -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); -- cgit v1.2.3