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:
@@ -827,8 +827,9 @@ wxString wxWebViewWebKit::GetPageSource() const
|
|||||||
g_main_context_iteration(main_context, TRUE);
|
g_main_context_iteration(main_context, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t length;
|
||||||
guchar *source = webkit_web_resource_get_data_finish(resource, result,
|
guchar *source = webkit_web_resource_get_data_finish(resource, result,
|
||||||
NULL, NULL);
|
&length, NULL);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
g_object_unref(result);
|
g_object_unref(result);
|
||||||
@@ -836,7 +837,7 @@ wxString wxWebViewWebKit::GetPageSource() const
|
|||||||
|
|
||||||
if (source)
|
if (source)
|
||||||
{
|
{
|
||||||
wxString wxs = wxString(source, wxConvUTF8);
|
wxString wxs(source, wxConvUTF8, length);
|
||||||
free(source);
|
free(source);
|
||||||
return wxs;
|
return wxs;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user