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

Unified Diff: content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc

Issue 883003005: Pepper: Fix PPB_TrueTypeFont GetFontsInFamily function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Leave room for null-terminator. Created 5 years, 11 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: content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
diff --git a/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc b/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
index 158d8ea9de104e7b5df86c90c1a13ef518592f8c..e271dbbb08ad0369884d20bb0697859667e06582 100644
--- a/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
+++ b/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc
@@ -76,7 +76,9 @@ void GetFontsInFamily_SlowBlocking(const std::string& family,
memset(&logfont, 0, sizeof(logfont));
logfont.lfCharSet = DEFAULT_CHARSET;
base::string16 family16 = base::UTF8ToUTF16(family);
- memcpy(&logfont.lfFaceName, &family16[0], sizeof(logfont.lfFaceName));
+ // Copy the family name, leaving room for a terminating null (already set
+ // since we zeroed the whole struct above.)
+ family16.copy(logfont.lfFaceName, LF_FACESIZE - 1);
base::win::ScopedCreateDC hdc(::CreateCompatibleDC(NULL));
::EnumFontFamiliesExW(hdc.Get(),
&logfont,
« 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