profanity-im / libmesode

*Deprecated* Fork of libstrophe (https://github.com/strophe/libstrophe) for use with Profanity XMPP Client
Other
17 stars 10 forks source link

example/basic segfaults during tls_start() #3

Closed pasis closed 8 years ago

pasis commented 8 years ago
xmpp DEBUG sock_connect to jabber.kiev.ua:5222 returned 3
xmpp DEBUG attempting to connect to jabber.kiev.ua
xmpp DEBUG connection successful
conn DEBUG SENT: <?xml version="1.0"?><stream:stream to="jabber.kiev.ua" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">
xmpp DEBUG RECV: <stream:stream id='4220094456' from='jabber.kiev.ua' version='1.0' lang='en'>
xmpp DEBUG RECV: <features xmlns="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c hash="sha-1" xmlns="http://jabber.org/protocol/caps" ver="myyYuD7G/jr9pzEG08BbJNWU3ug=" node="http://www.process-one.net/en/ejabberd/"/><register xmlns="http://jabber.org/features/iq-register"/></features>
conn DEBUG SENT: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
xmpp DEBUG RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
xmpp DEBUG handle proceedtls called for proceed
xmpp DEBUG proceeding with TLS
TLS DEBUG STACK
TLS DEBUG SUBJECT : /CN=jabber.kiev.ua
TLS DEBUG ISSUER  : /O=Root CA/OU=http://www.cacert.org/CN=CA Cert Signing Authority/emailAddress=support@cacert.org
TLS DEBUG ENDSTACK
TLS DEBUG ERROR: unable to get local issuer certificate
Segmentation fault (core dumped)
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007f25250118d5 in verify_callback (preverify_ok=0, x509_ctx=0x7ffc030ebf70) at src/tls_openssl.c:205
#2  0x00007f2524a9983e in X509_verify_cert () from /usr/lib64/libcrypto.so.1.0.0
#3  0x00007f2524dd1eb8 in ssl_verify_cert_chain () from /usr/lib64/libssl.so.1.0.0
#4  0x00007f2524dad7cb in ssl3_get_server_certificate () from /usr/lib64/libssl.so.1.0.0
#5  0x00007f2524db250e in ssl3_connect () from /usr/lib64/libssl.so.1.0.0
#6  0x00007f2524dbbce7 in ssl23_connect () from /usr/lib64/libssl.so.1.0.0
#7  0x00007f2525011b9c in tls_start (tls=0x25a1cd0) at src/tls_openssl.c:288
#8  0x00007f252500437a in conn_tls_start (conn=0x259dbf0) at src/conn.c:777
#9  0x00007f2525000a0f in _handle_proceedtls_default (conn=0x259dbf0, stanza=0x25a1c80, userdata=0x0) at src/auth.c:290
#10 0x00007f25250063fe in handler_fire_stanza (conn=0x259dbf0, stanza=0x25a1c80) at src/handler.c:101
#11 0x00007f2525004c1d in _handle_stream_stanza (stanza=0x25a1c80, userdata=0x259dbf0) at src/conn.c:1031
#12 0x00007f2525013289 in _end_element (userdata=0x259dd40, name=0x25a1e20 "urn:ietf:params:xml:ns:xmpp-tls\037proceed") at src/parser_expat.c:157
#13 0x00007f2524731994 in doContent () from /usr/lib64/libexpat.so.1
#14 0x00007f2524732951 in contentProcessor () from /usr/lib64/libexpat.so.1
#15 0x00007f25247348df in XML_ParseBuffer () from /usr/lib64/libexpat.so.1
#16 0x00007f2525013542 in parser_feed (parser=0x259dd40, 
    chunk=0x7ffc030ec6f0 "<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>xml:ns:xmpp-tls'/><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><mechanisms xmlns='urn:ietf:params:xml:n"..., 
    len=50) at src/parser_expat.c:247
#17 0x00007f2525005eea in xmpp_run_once (ctx=0x259db30, timeout=1) at src/event.c:287
#18 0x00007f252500608e in xmpp_run (ctx=0x259db30) at src/event.c:339
#19 0x0000000000400f72 in main (argc=3, argv=0x7ffc030ed868) at examples/basic.c:102

The problem is that a callback is NULL somewhere. Application must not crash even if there is an error with certificate.