From: Brendan Cully Date: Fri, 7 Mar 2003 14:55:53 +0000 (+0000) Subject: The global callbacks set up in sasl_client_init are not copied by X-Git-Tag: mutt-1-5-4-rel~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=361d5fe5d740a92086aeee582234484398b004c0;p=mutt The global callbacks set up in sasl_client_init are not copied by the SASL library, so they can't be allocated on the stack. This is the case with both versions of the SASL library, and I frankly don't understand why it hasn't caused problems before. Since it segfaults reliably on OS X for me now, I thought a patch would be in order. --- diff --git a/mutt_sasl.c b/mutt_sasl.c index 350cc307..7fc07bbb 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-1 Brendan Cully + * Copyright (C) 2000-3 Brendan Cully * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -85,23 +85,20 @@ int mutt_sasl_start (void) { static unsigned char sasl_init = 0; - sasl_callback_t* callback, callbacks[2]; + static sasl_callback_t callbacks[2]; int rc; if (sasl_init) return SASL_OK; /* set up default logging callback */ - callback = callbacks; + callbacks[0].id = SASL_CB_LOG; + callbacks[0].proc = mutt_sasl_cb_log; + callbacks[0].context = NULL; - callback->id = SASL_CB_LOG; - callback->proc = mutt_sasl_cb_log; - callback->context = NULL; - callback++; - - callback->id = SASL_CB_LIST_END; - callback->proc = NULL; - callback->context = NULL; + callbacks[1].id = SASL_CB_LIST_END; + callbacks[1].proc = NULL; + callbacks[1].context = NULL; rc = sasl_client_init (callbacks);