# HG changeset patch # User Paul Aurich # Date 1271540126 0 # Node ID 6eeb50155af80b8d29da53dc60e8301173ddcf09 # Parent 0f895633faeb2b397f67f8cc64af6dcd213c3f29 gtkimhtml: Fix handling of pastes whose data isn't NULL-terminated Rich-text pastes from Chrome now work (they failed the g_utf8_validate far past the end of the paste data) and I bet this also fixes the URIs-pasted-from-Chrome-have-odd-garbage-at-the-end thing, too. diff -r 0f895633faeb -r 6eeb50155af8 ChangeLog --- a/ChangeLog Sat Apr 17 21:16:19 2010 +0000 +++ b/ChangeLog Sat Apr 17 21:35:26 2010 +0000 @@ -45,6 +45,8 @@ buddy icons. * The 'Message Timestamp Formats' plugin allows changing the timestamp format from the timestamps' context menu in conversation log. + * Fix pastes from Chrome (rich-text pastes and probably URLs + having garbage appended to them) Bonjour: * Added support for IPv6. (Thanks to T_X for testing) diff -r 0f895633faeb -r 6eeb50155af8 pidgin/gtkimhtml.c --- a/pidgin/gtkimhtml.c Sat Apr 17 21:16:19 2010 +0000 +++ b/pidgin/gtkimhtml.c Sat Apr 17 21:35:26 2010 +0000 @@ -1185,8 +1185,14 @@ printf("\n"); } #endif - text = g_malloc(selection_data->length); + + text = g_malloc(selection_data->length + 1); memcpy(text, selection_data->data, selection_data->length); + /* Make sure the paste data is null-terminated. Given that + * we're passed length (but assume later that it is), this + * seems sensible to me. + */ + text[selection_data->length] = '\0'; } #ifdef _WIN32