mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syck/rubyext.c (rb_syck_mktime): avoid segmentation fault.
[ruby-core:13735] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9497f7996a
commit
e46a617759
3 changed files with 12 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Nov 30 19:33:38 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/syck/rubyext.c (rb_syck_mktime): avoid segmentation fault.
|
||||||
|
[ruby-core:13735]
|
||||||
|
|
||||||
Fri Nov 30 19:05:55 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri Nov 30 19:05:55 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* enum.c (enum_count): precise argument number check.
|
* enum.c (enum_count): precise argument number check.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# So all tests will cause failure.
|
# So all tests will cause failure.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
$:.unshift File.join(File.dirname(__FILE__), "../.ext/#{RUBY_PLATFORM}")
|
||||||
assert_normal_exit %q{
|
assert_normal_exit %q{
|
||||||
STDERR.reopen(STDOUT)
|
STDERR.reopen(STDOUT)
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
|
@ -262,9 +262,13 @@ rb_syck_mktime(char *str, long len)
|
||||||
{
|
{
|
||||||
char padded[] = "000000";
|
char padded[] = "000000";
|
||||||
char *end = ptr + 1;
|
char *end = ptr + 1;
|
||||||
|
char *p = end;
|
||||||
while ( isdigit( *end ) ) end++;
|
while ( isdigit( *end ) ) end++;
|
||||||
|
if (end - p < sizeof(padded)) {
|
||||||
MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
|
MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
|
||||||
usec = strtol(padded, NULL, 10);
|
p = padded;
|
||||||
|
}
|
||||||
|
usec = strtol(p, NULL, 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue