jscript: Do not include terminating \0 in result returned by Date_toLocale{Date,Time}String.

Sebastian Lackner sebastian at fds-team.de
Wed Sep 7 08:41:03 CDT 2016


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

Depends on http://source.winehq.org/patches/data/126345.
Tested manually - unfortunately the locale string parameter is ignored,
which means its not really easy to write reliable tests. :/

 dlls/jscript/date.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c
index b35d812..b6997ab 100644
--- a/dlls/jscript/date.c
+++ b/dlls/jscript/date.c
@@ -925,7 +925,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
         WCHAR *ptr;
 
         len = GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
-        date_str = jsstr_alloc_buf(len, &ptr);
+        date_str = jsstr_alloc_buf(len-1, &ptr);
         if(!date_str)
             return E_OUTOFMEMORY;
         GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, ptr, len);
@@ -964,7 +964,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
         WCHAR *ptr;
 
         len = GetTimeFormatW(ctx->lcid, 0, &st, NULL, NULL, 0);
-        date_str = jsstr_alloc_buf(len, &ptr);
+        date_str = jsstr_alloc_buf(len-1, &ptr);
         if(!date_str)
             return E_OUTOFMEMORY;
         GetTimeFormatW(ctx->lcid, 0, &st, NULL, ptr, len);
-- 
2.9.0



More information about the wine-patches mailing list