Blame SOURCES/cvs-1.11.23-Fix-proxy-response-parser.patch

36e843
From 73d49d17ce8db58e090f82719f7c9aad7340cbac Mon Sep 17 00:00:00 2001
36e843
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
36e843
Date: Tue, 17 Jan 2012 17:55:00 +0100
36e843
Subject: [PATCH] Fix proxy response parser
36e843
36e843
If proxy sends overlong HTTP vesion string, the string will be copied
36e843
to unallocatd space (write_buf) causing heap overflow.
36e843
36e843
This patch fixes it by ignoring the HTTP version string and checking
36e843
the response line has been parsed correctly.
36e843
36e843
See <https://bugzilla.redhat.com/show_bug.cgi?id=773699> for more
36e843
details.
36e843
---
36e843
 src/client.c |    4 ++--
36e843
 1 files changed, 2 insertions(+), 2 deletions(-)
36e843
36e843
diff --git a/src/client.c b/src/client.c
36e843
index d0abd41..80872be 100644
36e843
--- a/src/client.c
36e843
+++ b/src/client.c
36e843
@@ -3878,9 +3878,9 @@ proxy_connect (root, port_number)
36e843
     
36e843
     /* Wait for HTTP status code, bail out if you don't get back a 2xx code.*/
36e843
     count = read_line (&read_buf);
36e843
-    sscanf (read_buf, "%s %d", write_buf, &codenum);
36e843
+    count = sscanf (read_buf, "%*s %d", &codenum);
36e843
     
36e843
-    if ((codenum / 100) != 2)
36e843
+    if (count != 1 || (codenum / 100) != 2)
36e843
 	error (1, 0, "proxy server %s:%d does not support http tunnelling",
36e843
 	       root->proxy_hostname, root->proxy_port);
36e843
     free (read_buf);
36e843
-- 
36e843
1.7.7.5
36e843