syck.patch 615 B

1234567891011121314151617181920
  1. diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
  2. index 078de4f..8c4027f 100644
  3. --- a/ext/syck/rubyext.c
  4. +++ b/ext/syck/rubyext.c
  5. @@ -268,9 +268,13 @@ rb_syck_mktime(str, len)
  6. {
  7. char padded[] = "000000";
  8. char *end = ptr + 1;
  9. + char *p = end;
  10. while ( isdigit( *end ) ) end++;
  11. - MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
  12. - usec = strtol(padded, NULL, 10);
  13. + if (end - p < sizeof(padded)) {
  14. + MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
  15. + p = padded;
  16. + }
  17. + usec = strtol(p, NULL, 10);
  18. }
  19. else
  20. {