Blame SOURCES/0032-curl-7.61.1-CVE-2021-22898.patch

08b2e2
From ae2dc830fb37e9243dbdaf8b92e41df91f43b3f2 Mon Sep 17 00:00:00 2001
08b2e2
From: Harry Sintonen <sintonen@iki.fi>
08b2e2
Date: Fri, 7 May 2021 13:09:57 +0200
08b2e2
Subject: [PATCH] telnet: check sscanf() for correct number of matches
08b2e2
08b2e2
CVE-2021-22898
08b2e2
08b2e2
Bug: https://curl.se/docs/CVE-2021-22898.html
08b2e2
08b2e2
Upstream-commit: 39ce47f219b09c380b81f89fe54ac586c8db6bde
08b2e2
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
08b2e2
---
08b2e2
 lib/telnet.c | 2 +-
08b2e2
 1 file changed, 1 insertion(+), 1 deletion(-)
08b2e2
08b2e2
diff --git a/lib/telnet.c b/lib/telnet.c
08b2e2
index 1fc5af1..ea6bc71 100644
08b2e2
--- a/lib/telnet.c
08b2e2
+++ b/lib/telnet.c
08b2e2
@@ -967,7 +967,7 @@ static void suboption(struct connectdata *conn)
08b2e2
         size_t tmplen = (strlen(v->data) + 1);
08b2e2
         /* Add the variable only if it fits */
08b2e2
         if(len + tmplen < (int)sizeof(temp)-6) {
08b2e2
-          if(sscanf(v->data, "%127[^,],%127s", varname, varval)) {
08b2e2
+          if(sscanf(v->data, "%127[^,],%127s", varname, varval) == 2) {
08b2e2
             snprintf((char *)&temp[len], sizeof(temp) - len,
08b2e2
                      "%c%s%c%s", CURL_NEW_ENV_VAR, varname,
08b2e2
                      CURL_NEW_ENV_VALUE, varval);
08b2e2
-- 
08b2e2
2.31.1
08b2e2