mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/digest/digest.c (hexdigest_str_new): Add a string size check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d93a35b554
commit
8d0e66afdf
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Oct 6 02:06:10 2006 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* ext/digest/digest.c (hexdigest_str_new): Add a string size check.
|
||||
|
||||
Thu Oct 5 19:28:35 2006 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* ext/digest/digest.[ch]: Since the argument order of
|
||||
|
|
|
@ -45,7 +45,14 @@ hexdigest_str_new(const unsigned char *digest, size_t digest_len)
|
|||
int i;
|
||||
VALUE str;
|
||||
char *p;
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
static const char hex[] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
if (LONG_MAX / 2 < digest_len) {
|
||||
rb_raise(rb_eRuntimeError, "digest string too long");
|
||||
}
|
||||
|
||||
str = rb_str_new(0, digest_len * 2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue