From: Carlos Alberto Lopez Perez Date: Mon, 6 Aug 2012 00:00:07 +0000 (+0200) Subject: Fix infinite loop on s_client starttls xmpp X-Git-Tag: master-pre-reformat~1153 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4249d4ba8609d6892687df555d2727f8a7a302e9;p=openssl Fix infinite loop on s_client starttls xmpp * When the host used in "-connect" is not what the remote XMPP server expects the server will return an error like this: * But the actual code will stay on the loop forever because the stop condition "/stream:features>" will never happen, * Make this more robust: The stop condition should be that BIO_read failed * Test if for example with :: openssl s_client -connect random.jabb3r.net:5222 -starttls xmpp --- diff --git a/apps/s_client.c b/apps/s_client.c index c38c42e037..9c7f45f33c 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1676,9 +1676,11 @@ SSL_set_tlsext_status_ids(con, ids); while (!strstr(mbuf, "")) - goto shut; seen = BIO_read(sbio,mbuf,BUFSIZZ); + + if (seen <= 0) + goto shut; + mbuf[seen] = 0; } BIO_printf(sbio, "");