[totem] Truncate the baseURI to the length provided
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [totem] Truncate the baseURI to the length provided
- Date: Tue, 15 Sep 2009 00:27:12 +0000 (UTC)
commit 8a9dddc93a1050713bd55cf72e902b6e1cab45f9
Author: Bastien Nocera <hadess hadess net>
Date: Tue Sep 15 01:26:16 2009 +0100
Truncate the baseURI to the length provided
As seen in:
https://bugzilla.gnome.org/show_bug.cgi?id=537456
The baseURI might not be nil-terminated, so truncate it ourselves.
browser-plugin/totemNPVariantWrapper.h | 1 +
browser-plugin/totemPlugin.cpp | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/browser-plugin/totemNPVariantWrapper.h b/browser-plugin/totemNPVariantWrapper.h
index 5f7da50..7e3ce1c 100644
--- a/browser-plugin/totemNPVariantWrapper.h
+++ b/browser-plugin/totemNPVariantWrapper.h
@@ -54,6 +54,7 @@ class totemNPVariantWrapper {
uint32_t GetInt32 () const { return NPVARIANT_TO_INT32 (mVariant); }
double GetDouble () const { return NPVARIANT_TO_DOUBLE (mVariant); }
char * GetString () const { return (char *) NPVARIANT_TO_STRING (mVariant).UTF8Characters; }
+ uint32_t GetStringLen() const { return NPVARIANT_TO_STRING (mVariant).UTF8Length; }
NPString GetNPString () const { return NPVARIANT_TO_STRING (mVariant); }
NPObject* GetObject () const { return NPVARIANT_TO_OBJECT (mVariant); }
diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp
index 7bb16cf..381d5a7 100644
--- a/browser-plugin/totemPlugin.cpp
+++ b/browser-plugin/totemPlugin.cpp
@@ -1940,7 +1940,7 @@ totemPlugin::Init (NPMIMEType mimetype,
return NPERR_GENERIC_ERROR;
}
- mBaseURI = g_strdup (baseURI.GetString ());
+ mBaseURI = g_strndup (baseURI.GetString (), baseURI.GetStringLen());
D ("Base URI is '%s'", mBaseURI ? mBaseURI : "");
/* Setup DBus connection handling */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]