diff options
author | Diego Escalante Urrelo <descalante@igalia.com> | 2010-02-15 03:15:32 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <descalante@igalia.com> | 2010-02-15 03:50:51 +0800 |
commit | 8ee6dd74ab9f8aa5a51a73fb84e9f07870ae682a (patch) | |
tree | a8642c1d6d6fc35d3eae724d4cc7f55c99784bf8 /embed/ephy-web-view.c | |
parent | ce57e7c7d528b184ceae9575caec39e193c29aaa (diff) | |
download | gsoc2013-epiphany-8ee6dd74ab9f8aa5a51a73fb84e9f07870ae682a.tar.gz gsoc2013-epiphany-8ee6dd74ab9f8aa5a51a73fb84e9f07870ae682a.tar.zst gsoc2013-epiphany-8ee6dd74ab9f8aa5a51a73fb84e9f07870ae682a.zip |
Use correct UTF8 length when converting JSStrings
JSStringGetLength returns the number of UTF8 chars in the string, using this
value results in trimmed strings when they contain UTF8 chars.
The correct function is JSStringGetMaximumUTF8CStringSize that reports the
number of bytes the string requires to be allocated, including null-byte.
Bug #609936
Diffstat (limited to 'embed/ephy-web-view.c')
-rw-r--r-- | embed/ephy-web-view.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c index e87416dc1..bc321549b 100644 --- a/embed/ephy-web-view.c +++ b/embed/ephy-web-view.c @@ -550,7 +550,7 @@ js_value_to_string (JSContextRef js_context, g_return_val_if_fail (JSValueIsString (js_context, js_value), NULL); str = JSValueToStringCopy (js_context, js_value, NULL); - length = JSStringGetLength (str) + 1; + length = JSStringGetMaximumUTF8CStringSize (str); buffer = g_malloc0 (length); JSStringGetUTF8CString (str, buffer, length); |