Permalink
Browse files

Fix: Converted raw string include NULL character in charset module

  • Loading branch information...
1 parent b7ce935 commit d3a7283d0baa8c63e3a3e1b4c3819b735b14c9ab @akihiro akihiro committed Oct 11, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 modules/charset.cpp
View
@@ -45,7 +45,7 @@ class CCharsetMod : public CModule
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 @@ class CCharsetMod : public CModule
}
}
- uLength += (pOut - tmpbuf);
+ uLength += sizeof(tmpbuf) - uBufSize;
} while(!bBreak);
return uLength;
@@ -120,7 +120,7 @@ class CCharsetMod : public CModule
if(bResult)
{
- sData.assign(pResult, uLength);
+ sData.assign(pResult, (uLength + 1) - uResultBufSize);
DEBUG("charset: Converted: [" + sData.Escape_n(CString::EURL) + "] from [" + sFrom + "] to [" + sTo + "]!");
}

0 comments on commit d3a7283

Please sign in to comment.