diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-05-28 10:21:47 -0700 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-05-28 10:21:47 -0700 |
commit | 40c4fb881dad923c4dcbee3a9477e0a995f3bd04 (patch) | |
tree | 63785fb01fa295f412b1dc089b874680aac6fa51 /fpdfsdk | |
parent | 17211aecc66bab2e7576b0d620499a315d6b68a7 (diff) | |
download | pdfium-40c4fb881dad923c4dcbee3a9477e0a995f3bd04.tar.xz |
Fix a security issue in FPDF_GetMetaText
BUG=security
Review URL: https://codereview.chromium.org/307653002
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/src/fpdfdoc.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp index 4fa6ba2197..edd61f9e51 100644 --- a/fpdfsdk/src/fpdfdoc.cpp +++ b/fpdfsdk/src/fpdfdoc.cpp @@ -249,7 +249,7 @@ DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR // Use UTF-16LE encoding CFX_ByteString bstr = text.UTF16LE_Encode(); unsigned long len = bstr.GetLength(); - if (buffer != NULL || buflen >= len+2) { + if (buffer != NULL && buflen >= len+2) { FXSYS_memcpy(buffer, (FX_LPCSTR)bstr, len); // use double zero as trailer ((FX_BYTE*)buffer)[len] = ((FX_BYTE*)buffer)[len+1] = 0; |