From d3a7283d0baa8c63e3a3e1b4c3819b735b14c9ab Mon Sep 17 00:00:00 2001 From: Hiroaki Mizuguchi Date: Fri, 11 Oct 2013 12:21:43 +0000 Subject: [PATCH] Fix: Converted raw string include NULL character in charset module --- modules/charset.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/charset.cpp b/modules/charset.cpp index 61960f29..8abd7c63 100644 --- a/modules/charset.cpp +++ b/modules/charset.cpp @@ -45,7 +45,7 @@ private: do { char *pOut = tmpbuf; - size_t uBufSize = 1024; + size_t uBufSize = sizeof(tmpbuf); bBreak = (uInLen < 1); if(iconv(ic, // this is ugly, but keeps the code short: @@ -67,7 +67,7 @@ private: } } - uLength += (pOut - tmpbuf); + uLength += sizeof(tmpbuf) - uBufSize; } while(!bBreak); return uLength; @@ -120,7 +120,7 @@ private: if(bResult) { - sData.assign(pResult, uLength); + sData.assign(pResult, (uLength + 1) - uResultBufSize); DEBUG("charset: Converted: [" + sData.Escape_n(CString::EURL) + "] from [" + sFrom + "] to [" + sTo + "]!"); }