Permalink
Browse files

Merge pull request #418 from akihiro/master

Fix: Converted raw string include NULL character in charset module
  • Loading branch information...
flakes committed Oct 27, 2013
2 parents feca415 + d3a7283 commit 76d67e006e8477b9a65d7abfd6ba1164d5a026af
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 76d67e0

Please sign in to comment.