[PATCH] msvcp60: Avoid a crash, when the ptr in basic_string_char is NULL

Detlef Riekenberg wine.dev at web.de
Wed Jan 4 15:56:58 CST 2012


This fixes a crash in the www.giveawayoftheday.com installer wrapper.
http://bugs.winehq.org/show_bug.cgi?id=28370

--
By by ... Detlef
---
 dlls/msvcp60/string.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp60/string.c b/dlls/msvcp60/string.c
index 3c24b3d..500daa3 100644
--- a/dlls/msvcp60/string.c
+++ b/dlls/msvcp60/string.c
@@ -147,8 +147,10 @@ unsigned char* __thiscall basic_string_char__Refcnt(basic_string_char *this, con
 DEFINE_THISCALL_WRAPPER(basic_string_char__Eos, 8)
 void __thiscall basic_string_char__Eos(basic_string_char *this, MSVCP_size_t len)
 {
-    this->size = len;
-    this->ptr[len] = 0;
+    if (this->ptr) {
+        this->size = len;
+        this->ptr[len] = 0;
+    }
 }
 
 /* ?_Tidy@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@AAEX_N at Z */
-- 
1.7.5.4




More information about the wine-patches mailing list