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.
This commit is contained in:
Paul Cornett
2017-06-18 13:48:41 -07:00
parent 084009bff5
commit 74bde5690c

View File

@@ -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;
}