[gnome-shell/gnome-3-2] browser-plugin: Use g_strndup to get a string property
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-2] browser-plugin: Use g_strndup to get a string property
- Date: Wed, 18 Jan 2012 15:30:37 +0000 (UTC)
commit 62027beb8edb6e8ad37f940d378cbea66a991ee9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Nov 10 23:57:39 2011 -0500
browser-plugin: Use g_strndup to get a string property
WebKit-based browsers like Chromium and Epiphany may insert extra junk at the
end of NPStrings, so we cannot depend on the strlen matching.
https://bugzilla.gnome.org/show_bug.cgi?id=663823
browser-plugin/browser-plugin.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c
index 2daa0dd..b717889 100644
--- a/browser-plugin/browser-plugin.c
+++ b/browser-plugin/browser-plugin.c
@@ -71,10 +71,7 @@ get_string_property (NPP instance,
goto out;
result_str = NPVARIANT_TO_STRING (result);
- if (strlen (result_str.UTF8Characters) != result_str.UTF8Length)
- goto out;
-
- result_copy = g_strdup (result_str.UTF8Characters);
+ result_copy = g_strndup (result_str.UTF8Characters, result_str.UTF8Length);
out:
funcs.releasevariantvalue (&result);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]