diff options
author | Radek Doulik <rodo@ximian.com> | 2004-01-26 22:58:50 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2004-01-26 22:58:50 +0800 |
commit | b4f2035009192801a7dd02b3f6d6987d94ee3826 (patch) | |
tree | 76cf890140405b66e0153c013d7fe999422106dc /addressbook/gui | |
parent | 47fddd12268ed28b29bc825386189299ef9b1c62 (diff) | |
download | gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.tar gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.tar.gz gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.tar.bz2 gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.tar.lz gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.tar.xz gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.tar.zst gsoc2013-evolution-b4f2035009192801a7dd02b3f6d6987d94ee3826.zip |
make sure we pass \0 terminated string to eab_contact_list_from_string [it
2004-01-26 Radek Doulik <rodo@ximian.com>
* gui/widgets/e-addressbook-view.c (selection_received): make sure
we pass \0 terminated string to eab_contact_list_from_string
[it may fix #51743]
svn path=/trunk/; revision=24435
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index e3be750b07..633988ee31 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -1905,13 +1905,19 @@ selection_received (GtkWidget *invisible, guint time, EABView *view) { - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { + if (selection_data->length <= 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { return; - } - else { - /* XXX make sure selection_data->data = \0 terminated */ - GList *contact_list = eab_contact_list_from_string (selection_data->data); + } else { + GList *contact_list; GList *l; + char *str = NULL; + + if (selection_data->data [selection_data->length - 1] != 0) { + str = g_malloc0 (selection_data->length + 1); + memcpy (str, selection_data->data, selection_data->length); + contact_list = eab_contact_list_from_string (str); + } else + contact_list = eab_contact_list_from_string (selection_data->data); for (l = contact_list; l; l = l->next) { EContact *contact = l->data; @@ -1922,6 +1928,7 @@ selection_received (GtkWidget *invisible, g_list_foreach (contact_list, (GFunc)g_object_unref, NULL); g_list_free (contact_list); + g_free (str); } } |