summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-07-10 11:49:52 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-07-10 11:49:52 -0700
commitd5a0e7ac0a8169220b32cd8525b6cc5a6e563af3 (patch)
tree8fc580882b9d4001651047a2d0808e3057ef8373 /core/src/fpdfapi
parentb66432c91c35ef49d53377a250f42448bdd8fbf1 (diff)
downloadpdfium-d5a0e7ac0a8169220b32cd8525b6cc5a6e563af3.tar.xz
Zero out temporary arrays before use in PDF encryption.
BUG=387834 R=palmer@chromium.org Review URL: https://codereview.chromium.org/386663003
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index e09bbbbb2e..417801b9c5 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -406,6 +406,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_
copy_len = ukey.GetLength();
}
FXSYS_memset32(test, 0, sizeof(test));
+ FXSYS_memset32(tmpkey, 0, sizeof(tmpkey));
FXSYS_memcpy32(test, (FX_LPCSTR)ukey, copy_len);
for (int i = 19; i >= 0; i --) {
for (int j = 0; j < key_len; j ++) {
@@ -466,6 +467,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa
} else {
for (int i = 19; i >= 0; i --) {
FX_BYTE tempkey[32];
+ FXSYS_memset32(tempkey, 0, sizeof(tempkey));
for (int j = 0; j < m_KeyLen; j ++) {
tempkey[j] = enckey[j] ^ i;
}