From: Jeffrey Altman Date: Mon, 1 Oct 2007 20:09:55 +0000 (+0000) Subject: remove error tables by pointer X-Git-Tag: krb5-1.7-alpha1~823 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=72a6d7f1585125e05a39eb57a95bf779fd2c160e;p=krb5.git remove error tables by pointer On Windows, it is possible for the same DLL to be loaded into a process multiple times as separate instances. Each time a DLL is loaded it registers its error tables at different locations in the process address space. Removing the tables by base instead of pointer value can result in the error table list pointing at invalid memory. ticket: new tags: pullup target_version: 1.6.3 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20040 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index 62be6a6e7..897b7a24c 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -338,17 +338,17 @@ remove_error_table(const struct error_table * et) if (merr) return merr; - /* Remove the first occurrance we can find. Prefer dynamic + /* Remove the entry that matches the error table instance. Prefer dynamic entries, but if there are none, check for a static one too. */ for (del = &et_list_dynamic; *del; del = &(*del)->next) - if ((*del)->table->base == et->base) { + if ((*del)->table == et) { /*@only@*/ struct dynamic_et_list *old = *del; *del = old->next; free (old); return k5_mutex_unlock(&et_list_lock); } for (el = &_et_list; *el; el = &(*el)->next) - if ((*el)->table != NULL && (*el)->table->base == et->base) { + if ((*el)->table == et) { struct et_list *old = *el; *el = old->next; old->next = NULL;