[Spice-devel] [spice-gtk 2/2] sasl: Fix crash when ending a SASL session
Christophe Fergeau
cfergeau at redhat.com
Wed Oct 16 17:39:10 CEST 2013
When exiting remote-viewer after authenticating through SASL, I got
this crash:
#0 0x0000000100a51870 in ?? ()
#1 0x000000314d20c53e in _sasl_log (conn=<optimized out>, level=5, fmt=0x7fffe49893e8 "DIGEST-MD5 client mech dispose")
at common.c:1985
#2 0x00007fffe4982d88 in digestmd5_client_mech_dispose (conn_context=0xaf1900, utils=0xaefd10) at digestmd5.c:4580
#3 0x000000314d208654 in client_dispose (pconn=0xaf0710) at client.c:332
#4 0x000000314d20b76b in sasl_dispose (pconn=0xa51898) at common.c:851
#5 0x00007ffff7602dc7 in channel_reset (channel=0xa52250, migrating=0) at spice-channel.c:2493
#6 0x00007ffff760f7b7 in spice_inputs_channel_reset (channel=0xa52250, migrating=0) at channel-inputs.c:615
#7 0x00007ffff76030ac in spice_channel_reset (channel=0xa52250, migrating=0) at spice-channel.c:2551
#8 0x00007ffff76031e0 in channel_disconnect (channel=0xa52250) at spice-channel.c:2570
#9 0x00007ffff760283d in spice_channel_coroutine (data=0xa52250) at spice-channel.c:2368
#10 0x00007ffff763d14b in coroutine_trampoline (cc=0xa51900) at coroutine_ucontext.c:58
#11 0x00007ffff763ce30 in continuation_trampoline (i0=10819840, i1=0) at continuation.c:49
#12 0x00000031342479c0 in ?? () from /lib64/libc.so.6
#13 0x0000000000a51cc8 in ?? ()
#14 0x0000000000000000 in ?? ()
It turns out that the sasl_callback_t data passed when calling
sasl_client_new() must be valid until sasl_dispose() is called. I could not
find mentions of this in the official documentation but
https://mail-archives.apache.org/mod_mbox/subversion-dev/201109.mbox/%3C20110908072256.GN25324@ted.stsp.name%3E
describes what happens.
Making the sasl_callback_t structure static should be enough to guarantee
that the data will stay around long enough.
---
gtk/spice-channel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 9b2697e..ad1d727 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -1325,7 +1325,7 @@ static gboolean spice_channel_perform_auth_sasl(SpiceChannel *channel)
char *localAddr = NULL, *remoteAddr = NULL;
const void *val;
sasl_ssf_t ssf;
- sasl_callback_t saslcb[] = {
+ static const sasl_callback_t saslcb[] = {
{ .id = SASL_CB_PASS },
{ .id = 0 },
};
--
1.8.3.1
More information about the Spice-devel
mailing list