summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfxfa
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-11-25 11:13:50 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-11-25 11:13:50 +0800
commitc70b19aad245fb1ed39bf8c264d991555f4c5a58 (patch)
tree5a86d91e65962343aba109e46ed58c9d9b999933 /fpdfsdk/src/fpdfxfa
parent01fe5885b4dfbd9f116fb62b7bce585c153bfa77 (diff)
downloadpdfium-c70b19aad245fb1ed39bf8c264d991555f4c5a58.tar.xz
Fix invalid buffer length set in CFX_WideString::UTF16LE_Encode()
BUG=pdfium:275 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1443603002 .
Diffstat (limited to 'fpdfsdk/src/fpdfxfa')
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
index 0ff2ac7728..051dad2c95 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
@@ -207,7 +207,9 @@ void CPDFXFA_App::Response(CFX_WideString& wsAnswer,
nLength = nLength > 2046 ? 2046 : nLength;
pBuff[nLength] = 0;
pBuff[nLength + 1] = 0;
- wsAnswer = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLength);
+ wsAnswer = CFX_WideString::FromUTF16LE(
+ reinterpret_cast<const unsigned short*>(pBuff),
+ nLength / sizeof(unsigned short));
}
delete[] pBuff;
}