summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2009-09-15 01:26:16 +0100
committerBastien Nocera <hadess@hadess.net>2009-09-15 01:26:16 +0100
commit8a9dddc93a1050713bd55cf72e902b6e1cab45f9 (patch)
tree74d6e520c4fbb66877f729e0567abb6e02a02a6d
parente7b035dd531406066f75ee9f28c4ba56ad667464 (diff)
downloadtotem-8a9dddc93a1050713bd55cf72e902b6e1cab45f9.tar.gz
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.
-rw-r--r--browser-plugin/totemNPVariantWrapper.h1
-rw-r--r--browser-plugin/totemPlugin.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/browser-plugin/totemNPVariantWrapper.h b/browser-plugin/totemNPVariantWrapper.h
index 5f7da50a5..7e3ce1ce3 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 7bb16cf70..381d5a76b 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 */