From a72b3b2245ff0aaf6bd35cd229357e5aec4378ad Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 18 Jul 2001 02:11:23 +0000 Subject: [ Fixes bugs #4611 - crash searching in the name field at Bigfoot for "\" 2001-07-17 Chris Toshok [ Fixes bugs #4611 - crash searching in the name field at Bigfoot for "\" and #4554 - general ldap search crash ] * backend/pas/pas-backend-ldap.c (func_contains): the length of the big query string needs to take into account the length of the footer as well as the header - fix random memory corruption here. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_build_query): list can be NULL, specifically if there's a parsing error in the sexp, so deal with it. svn path=/trunk/; revision=11192 --- addressbook/ChangeLog | 13 +++++++++++++ addressbook/backend/pas/pas-backend-ldap.c | 18 ++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 480df273e7..81b7583ce4 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,16 @@ +2001-07-17 Chris Toshok + + [ Fixes bugs #4611 - crash searching in the name field at Bigfoot for "\" + and #4554 - general ldap search crash ] + + * backend/pas/pas-backend-ldap.c (func_contains): the length of + the big query string needs to take into account the length of the + footer as well as the header - fix random memory corruption here. + + * backend/pas/pas-backend-ldap.c (pas_backend_ldap_build_query): + list can be NULL, specifically if there's a parsing error in the + sexp, so deal with it. + 2001-07-17 Jon Trowbridge * backend/ebook/e-book-view-listener.c diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index e1312ee5b9..056e56f28f 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -1552,7 +1552,7 @@ func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data match_str = g_strdup_printf("=*%s%s)", str, one_star ? "" : "*"); - query_length = strlen (header); + query_length = strlen (header) + strlen (footer); for (i = 0; i < num_prop_infos; i ++) { query_length += 1 + strlen(prop_info[i].ldap_attr) + strlen (match_str); @@ -1727,13 +1727,19 @@ pas_backend_ldap_build_query (gchar *query) e_sexp_result_free(sexp, r); e_sexp_unref (sexp); - if (list->next) { - g_warning ("conversion to ldap query string failed"); - retval = NULL; - g_list_foreach (list, (GFunc)g_free, NULL); + if (list) { + if (list->next) { + g_warning ("conversion to ldap query string failed"); + retval = NULL; + g_list_foreach (list, (GFunc)g_free, NULL); + } + else { + retval = list->data; + } } else { - retval = list->data; + g_warning ("conversion to ldap query string failed"); + retval = NULL; } g_list_free (list); -- cgit v1.2.3