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

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