crypt32: Fix filetime_to_str() for the case where it is called twice for a single trace.

Francois Gouget fgouget at free.fr
Sun Sep 18 15:55:20 CDT 2011


---

In dump_element() we have this code snippet:

    TRACE_(chain)("valid from %s to %s\n",
     filetime_to_str(&cert->pCertInfo->NotBefore),
     filetime_to_str(&cert->pCertInfo->NotAfter));

This obviously does not work if filetime_to_str() always returns a 
pointer to the same buffer. Hence this patch.


 dlls/crypt32/chain.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c
index 4bc2d05..2c6732d 100644
--- a/dlls/crypt32/chain.c
+++ b/dlls/crypt32/chain.c
@@ -1664,7 +1664,7 @@ static void dump_extension(const CERT_EXTENSION *ext)
 
 static LPCSTR filetime_to_str(const FILETIME *time)
 {
-    static char date[80];
+    char date[80];
     char dateFmt[80]; /* sufficient for all versions of LOCALE_SSHORTDATE */
     SYSTEMTIME sysTime;
 
@@ -1675,7 +1675,7 @@ static LPCSTR filetime_to_str(const FILETIME *time)
     FileTimeToSystemTime(time, &sysTime);
     GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date,
      sizeof(date) / sizeof(date[0]));
-    return date;
+    return wine_dbg_sprintf("%s", date);
 }
 
 static void dump_element(PCCERT_CONTEXT cert)
-- 
1.7.5.4



More information about the wine-patches mailing list