From: Richard Levitte Date: Thu, 20 Jul 2017 19:22:31 +0000 (+0200) Subject: Fix apps/s_client.c's XMPP client X-Git-Tag: OpenSSL_1_0_2m~55 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=56d909863dcff26e82ebb06d185668f00287f67b;p=oweals%2Fopenssl.git Fix apps/s_client.c's XMPP client When an error occurs during the starttls handskake, s_client gets stuck looping around zero bytes reads, because the server won't sent anything more after its error tag. Shutting down on the first zero byte read fixes this. Fixes #3980 Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3981) --- diff --git a/apps/s_client.c b/apps/s_client.c index 85c1b6b579..dc467994f8 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1667,6 +1667,8 @@ int MAIN(int argc, char **argv) if (strstr(mbuf, "/stream:features>")) goto shut; seen = BIO_read(sbio, mbuf, BUFSIZZ); + if (seen <= 0) + goto shut; mbuf[seen] = 0; } BIO_printf(sbio,