diff options
-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); } |