diff options
author | Chris Toshok <toshok@ximian.com> | 2001-11-13 08:18:14 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-11-13 08:18:14 +0800 |
commit | 6f6b1c0af0b8a7bf1a87a0b2089a88059423da38 (patch) | |
tree | 084a369119b50b7dbe6fbce902d0ce3834d2e567 | |
parent | 10752c7a830ae7ac3a5ddad9192c3f464a281c4e (diff) | |
download | gsoc2013-evolution-6f6b1c0af0b8a7bf1a87a0b2089a88059423da38.tar.gz gsoc2013-evolution-6f6b1c0af0b8a7bf1a87a0b2089a88059423da38.tar.zst gsoc2013-evolution-6f6b1c0af0b8a7bf1a87a0b2089a88059423da38.zip |
[ Fixes Ximian bug #14843 ] don't crash if a subexpression wasn't filled
2001-11-12 Chris Toshok <toshok@ximian.com>
[ Fixes Ximian bug #14843 ]
* backend/pas/pas-backend-ldap.c (func_and): don't crash if a
subexpression wasn't filled in.
* backend/pas/pas-backend-ldap.c (func_or): same.
svn path=/trunk/; revision=14678
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-ldap.c | 19 |
2 files changed, 19 insertions, 8 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index b5c9a6e9f4..b14a744509 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-11-12 Chris Toshok <toshok@ximian.com> + + [ Fixes Ximian bug #14843 ] + * backend/pas/pas-backend-ldap.c (func_and): don't crash if a + subexpression wasn't filled in. + + * backend/pas/pas-backend-ldap.c (func_or): same. + 2001-11-12 Jon Trowbridge <trow@ximian.com> * gui/contact-list-editor/e-contact-list-editor.c (list_added_cb): diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 3b0cb673af..0618f43092 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -1764,15 +1764,16 @@ func_and(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) if (argc > 0) { int i; - strings = g_new(char*, argc+3); + strings = g_new0(char*, argc+3); strings[0] = g_strdup ("(&"); strings[argc+3 - 2] = g_strdup (")"); - strings[argc+3 - 1] = NULL; for (i = 0; i < argc; i ++) { GList *list_head = *list; - strings[argc - i] = (*list)->data; - *list = g_list_remove_link(*list, *list); + if (!list_head) + break; + strings[argc - i] = list_head->data; + *list = g_list_remove_link(list_head, list_head); g_list_free_1(list_head); } @@ -1800,14 +1801,16 @@ func_or(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) if (argc > 0) { int i; - strings = g_new(char*, argc+3); + strings = g_new0(char*, argc+3); strings[0] = g_strdup ("(|"); strings[argc+3 - 2] = g_strdup (")"); - strings[argc+3 - 1] = NULL; + for (i = 0; i < argc; i ++) { GList *list_head = *list; - strings[argc - i] = (*list)->data; - *list = g_list_remove_link(*list, *list); + if (!list_head) + break; + strings[argc - i] = list_head->data; + *list = g_list_remove_link(list_head, list_head); g_list_free_1(list_head); } |