Andrew Nguyen : msvcrt: Null terminate the temporary locale buffer in _create_locale.

Alexandre Julliard julliard at winehq.org
Mon Jan 17 10:59:48 CST 2011


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

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Sat Jan 15 02:28:24 2011 -0600

msvcrt: Null terminate the temporary locale buffer in _create_locale.

Spotted with Valgrind.

---

 dlls/msvcrt/locale.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 06c8da1..2f2be43 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -676,6 +676,7 @@ MSVCRT__locale_t MSVCRT__create_locale(int category, const char *locale)
                 lcid[i] = 0;
             else if(p) {
                 memcpy(buf, locale, p-locale);
+                buf[p-locale] = '\0';
                 lcid[i] = MSVCRT_locale_to_LCID(buf);
             } else
                 lcid[i] = MSVCRT_locale_to_LCID(locale);




More information about the wine-cvs mailing list