mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/ossl.c (ossl_raise): avoid buffer overrun. [ruby-dev:25187]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a87ff1d339
commit
2235b8c36d
2 changed files with 8 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Dec 14 14:03:57 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* ext/openssl/ossl.c (ossl_raise): avoid buffer overrun.
|
||||||
|
[ruby-dev:25187]
|
||||||
|
|
||||||
Tue Dec 14 08:47:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Dec 14 08:47:45 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (Init_eval): should mark ruby_eval_tree. [ruby-dev:25189]
|
* eval.c (Init_eval): should mark ruby_eval_tree. [ruby-dev:25189]
|
||||||
|
|
|
@ -285,17 +285,17 @@ ossl_raise(VALUE exc, const char *fmt, ...)
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
len = vsnprintf(buf, BUFSIZ, fmt, args);
|
len = vsnprintf(buf, BUFSIZ, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
len += snprintf(buf+len, BUFSIZ-len, ": ");
|
|
||||||
}
|
}
|
||||||
if (e) {
|
if (len < BUFSIZ && e) {
|
||||||
if (dOSSL == Qtrue) /* FULL INFO */
|
if (dOSSL == Qtrue) /* FULL INFO */
|
||||||
msg = ERR_error_string(e, NULL);
|
msg = ERR_error_string(e, NULL);
|
||||||
else
|
else
|
||||||
msg = ERR_reason_error_string(e);
|
msg = ERR_reason_error_string(e);
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
len += snprintf(buf+len, BUFSIZ-len, "%s", msg);
|
len += snprintf(buf+len, BUFSIZ-len, ": %s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(len > BUFSIZ) len = strlen(buf);
|
||||||
rb_exc_raise(rb_exc_new(exc, buf, len));
|
rb_exc_raise(rb_exc_new(exc, buf, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue