summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/pointer.h1
-rw-r--r--src/util/string.cpp5
2 files changed, 4 insertions, 2 deletions
diff --git a/src/util/pointer.h b/src/util/pointer.h
index f65683332..ba43b7844 100644
--- a/src/util/pointer.h
+++ b/src/util/pointer.h
@@ -197,6 +197,7 @@ public:
else
data = NULL;
refcount = new unsigned int;
+ memset(data,0,sizeof(T)*m_size);
(*refcount) = 1;
}
SharedBuffer(const SharedBuffer &buffer)
diff --git a/src/util/string.cpp b/src/util/string.cpp
index a2312baf8..39a14598b 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -41,8 +41,9 @@ std::string wide_to_narrow(const std::wstring& wcs)
size_t mbl = wcs.size()*4;
SharedBuffer<char> mbs(mbl+1);
size_t l = wcstombs(*mbs, wcs.c_str(), mbl);
- if(l == (size_t)(-1))
- mbs[0] = 0;
+ if(l == (size_t)(-1)) {
+ return "Character conversion failed!";
+ }
else
mbs[l] = 0;
return *mbs;