From 40c4fb881dad923c4dcbee3a9477e0a995f3bd04 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Wed, 28 May 2014 10:21:47 -0700 Subject: Fix a security issue in FPDF_GetMetaText BUG=security Review URL: https://codereview.chromium.org/307653002 --- fpdfsdk/src/fpdfdoc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3