diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-09 15:27:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-04-09 15:27:39 +0000 |
commit | 2e10fa962f8b7e93e1e208e22de75820732271c7 (patch) | |
tree | 3a1bc35eabb3fd0c34e91afbf66f153aa3eba041 | |
parent | 8e09f5b907868d3524e3e0557ca7bdf7cd2d73c8 (diff) |
* time.c (time_strftime): RSTRING(format)->ptr might become NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | time.c | 6 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,7 @@ +Thu Apr 10 00:27:07 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> + + * time.c (time_strftime): RSTRING(format)->ptr might become NULL. + Wed Apr 9 23:54:50 2003 Yukihiro Matsumoto <matz@ruby-lang.org> * variable.c (rb_obj_remove_instance_variable): better message. @@ -1279,7 +1279,7 @@ time_strftime(time, format) if (len == 0) { rb_warning("strftime called with empty format string"); } - if (strlen(fmt) < len) { + else if (strlen(fmt) < len) { /* Ruby string may contain \0's. */ char *p = fmt, *pe = fmt + len; @@ -1297,7 +1297,9 @@ time_strftime(time, format) } return str; } - len = rb_strftime(&buf, RSTRING(format)->ptr, &tobj->tm); + else { + len = rb_strftime(&buf, RSTRING(format)->ptr, &tobj->tm); + } str = rb_str_new(buf, len); if (buf != buffer) free(buf); return str; |