From e251e858b941e29bb95a6c0d26bb45981a872585 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Tue, 26 Dec 2023 19:08:48 -0500 Subject: [PATCH] vtls: fix missing multissl version info - Fix erroneous buffer copy logic from ff74cef5. Prior to this change the MultiSSL version info returned to the user was empty. Closes https://github.com/curl/curl/pull/12599 --- lib/vtls/vtls.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 256b8faa80..7f6ce09d7c 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -1413,10 +1413,12 @@ static size_t multissl_version(char *buffer, size_t size) backends_len = p - backends; } - if(size && (size < backends_len)) - strcpy(buffer, backends); - else - *buffer = 0; /* did not fit */ + if(size) { + if(backends_len < size) + strcpy(buffer, backends); + else + *buffer = 0; /* did not fit */ + } return 0; }