From 74bde5690ce5df6a93dba9f7907300a51b0035a4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 18 Jun 2017 13:48:41 -0700 Subject: [PATCH] Use reported size for page source string Avoids a warning from Valgrind about reading uninitialized byte in strlen. The string does not seem to be nul-terminated. --- src/gtk/webview_webkit2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 6707cec719..f2e67d3202 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -827,8 +827,9 @@ wxString wxWebViewWebKit::GetPageSource() const g_main_context_iteration(main_context, TRUE); } + size_t length; guchar *source = webkit_web_resource_get_data_finish(resource, result, - NULL, NULL); + &length, NULL); if (result) { g_object_unref(result); @@ -836,7 +837,7 @@ wxString wxWebViewWebKit::GetPageSource() const if (source) { - wxString wxs = wxString(source, wxConvUTF8); + wxString wxs(source, wxConvUTF8, length); free(source); return wxs; }