Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: fpdfsdk/src/fpdfdoc.cpp

Issue 307653002: Fix a security issue in FPDF_GetMetaText (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfdoc.cpp
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index 4fa6ba21974c39d7d9c9e0a983f8afa40aab784f..edd61f9e516431cd6faa39fc220c11c4c000365a 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698