Call nsIUnicharEncoder::Finish to ensure the converted string is terminated,
bug 179392, r=shanjian, sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@133774 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
02536b8319
commit
9a22e917e7
@ -97,7 +97,14 @@ NS_IMETHODIMP nsTextToSubURI::ConvertAndEscape(
|
||||
outlen = 255;
|
||||
pBuf = buf;
|
||||
}
|
||||
PRInt32 bufLen = outlen;
|
||||
if(NS_SUCCEEDED(rv = encoder->Convert(text,&ulen, pBuf, &outlen))) {
|
||||
// put termination characters (e.g. ESC(B of ISO-2022-JP) if necessary
|
||||
PRInt32 finLen = bufLen - outlen;
|
||||
if (finLen > 0) {
|
||||
if (NS_SUCCEEDED(encoder->Finish((char *)(pBuf+outlen), &finLen)))
|
||||
outlen += finLen;
|
||||
}
|
||||
pBuf[outlen] = '\0';
|
||||
*_retval = nsEscape(pBuf, url_XPAlphas);
|
||||
if(nsnull == *_retval)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user