From e47ebfe5187a19a1d379b97810cd8684de8cc339 Mon Sep 17 00:00:00 2001 From: suke Date: Sat, 28 Jun 2008 23:00:58 +0000 Subject: * ext/win32ole/win32ole.c (date2time_str): fix the overflow in some situation. [ruby-bugs-20793] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/win32ole/win32ole.c | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90bbacb94c..6cad6b4a23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jun 29 07:53:08 2008 Masaki Suketa + + * ext/win32ole/win32ole.c (date2time_str): fix the overflow in + some situation. [ruby-bugs-20793] + Sat Jun 28 21:25:08 2008 Tanaka Akira * include/ruby/ruby.h (struct RRegexp): new field usecnt. replace diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 17d61a7769..7fd9181405 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -116,7 +116,7 @@ #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "1.1.6" +#define WIN32OLE_VERSION "1.1.7" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -768,12 +768,10 @@ static VALUE date2time_str(double date) { int y, m, d, hh, mm, ss; - char szTime[20]; double2time(date, &y, &m, &d, &hh, &mm, &ss); - sprintf(szTime, + return rb_sprintf( "%04d/%02d/%02d %02d:%02d:%02d", y, m, d, hh, mm, ss); - return rb_str_new2(szTime); } #define ENC_MACHING_CP(enc,encname,cp) if(strcasecmp(rb_enc_name((enc)),(encname)) == 0) return cp -- cgit v1.2.3