File curl-CVE-2021-22898.patch of Package curl.30927

From 280f4238182c4f2bc5843ce1fefce3dbc2220033 Mon Sep 17 00:00:00 2001
From: Harry Sintonen <sintonen@iki.fi>
Date: Fri, 7 May 2021 13:09:57 +0200
Subject: [PATCH] telnet: check sscanf() for correct number of matches

CVE-2021-22898

Bug: https://curl.se/docs/CVE-2021-22898.html
---
 lib/telnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: curl-7.66.0/lib/telnet.c
===================================================================
--- curl-7.66.0.orig/lib/telnet.c
+++ curl-7.66.0/lib/telnet.c
@@ -967,7 +967,7 @@ static void suboption(struct connectdata
         size_t tmplen = (strlen(v->data) + 1);
         /* Add the variable only if it fits */
         if(len + tmplen < (int)sizeof(temp)-6) {
-          if(sscanf(v->data, "%127[^,],%127s", varname, varval)) {
+          if(sscanf(v->data, "%127[^,],%127s", varname, varval) == 2) {
             msnprintf((char *)&temp[len], sizeof(temp) - len,
                       "%c%s%c%s", CURL_NEW_ENV_VAR, varname,
                       CURL_NEW_ENV_VALUE, varval);
openSUSE Build Service is sponsored by