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 | 43372b8fe973f6c85e83d750d6f845314cb6bdc2 (patch) | |
tree | 3a1bc35eabb3fd0c34e91afbf66f153aa3eba041 /time.c | |
parent | ecc6fc60b34461c8957a2a1fa884fd86a29dab4e (diff) | |
download | ruby-43372b8fe973f6c85e83d750d6f845314cb6bdc2.tar.gz ruby-43372b8fe973f6c85e83d750d6f845314cb6bdc2.tar.xz ruby-43372b8fe973f6c85e83d750d6f845314cb6bdc2.zip |
* time.c (time_strftime): RSTRING(format)->ptr might become NULL.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; |