Alexandre Julliard : propsys: Don' t use the format string size as buffer size.

Alexandre Julliard julliard at winehq.org
Mon Aug 28 14:05:17 CDT 2017


Module: wine
Branch: master
Commit: 7960ed9d428640928ff1958fdfb9e89467a8d8fe
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7960ed9d428640928ff1958fdfb9e89467a8d8fe

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 28 18:15:12 2017 +0200

propsys: Don't use the format string size as buffer size.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/propsys/propvar.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/dlls/propsys/propvar.c b/dlls/propsys/propvar.c
index 90e20e3..ca3b421 100644
--- a/dlls/propsys/propvar.c
+++ b/dlls/propsys/propvar.c
@@ -49,22 +49,16 @@ static HRESULT PROPVAR_ConvertFILETIME(const FILETIME *ft, PROPVARIANT *ppropvar
     switch (vt)
     {
         case VT_LPSTR:
-        {
-            static const char format[] = "%04d/%02d/%02d:%02d:%02d:%02d.%03d";
-
-            ppropvarDest->u.pszVal = HeapAlloc(GetProcessHeap(), 0,
-                                             sizeof(format));
+            ppropvarDest->u.pszVal = HeapAlloc(GetProcessHeap(), 0, 64);
             if (!ppropvarDest->u.pszVal)
                 return E_OUTOFMEMORY;
 
-            snprintf( ppropvarDest->u.pszVal, sizeof(format),
-                      format,
+            sprintf( ppropvarDest->u.pszVal, "%04d/%02d/%02d:%02d:%02d:%02d.%03d",
                       time.wYear, time.wMonth, time.wDay,
                       time.wHour, time.wMinute, time.wSecond,
                       time.wMilliseconds );
 
             return S_OK;
-        }
 
         default:
             FIXME("Unhandled target type: %d\n", vt);




More information about the wine-cvs mailing list